我有一些代码正在处理我的某个应用程序; 所以我复制了代码,进行了必要的更改(即textField名称等),除非我将其移动到UIImageView,否则它会起作用; 没有出现.这是我的代码:
viewController.h(为简洁起见,仅显示相关部分)
#import "AppDelegate.h"
#import "Books.h"
#import <AVFoundation/AVFoundation.h>
#import "MBProgressHUD.h"
#import <MobileCoreServices/MobileCoreServices.h>
#import <UIKit/UIKit.h>
@class Books;
@interface DetailViewController : UIViewController <UITextFieldDelegate,
UIPopoverControllerDelegate,
UIPickerViewDataSource,
UIPickerViewDelegate,
UIActionSheetDelegate,
UIScrollViewDelegate,
UIImagePickerControllerDelegate,
AVCaptureMetadataOutputObjectsDelegate> {
}
// UIView
@property (strong, nonatomic) IBOutlet UIView *bookDetailView;
// camera stuff
@property (strong, nonatomic) IBOutlet UIImageView *oBookImage;
- (IBAction)bOpenCamera:(UIButton *)sender;
Run Code Online (Sandbox Code Playgroud)
这是相关的viewController.m代码:
#pragma mark - Camera stuff
- (IBAction)bOpenCamera:(UIButton *)sender {
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {
UIImagePickerController *imagePicker = [UIImagePickerController new];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.mediaTypes = [NSArray arrayWithObjects: (NSString …Run Code Online (Sandbox Code Playgroud) 这是我的代码:
//-- check for d/b; create it if it doesn't exist
NSString *docsDir;
NSArray *dirPaths;
NSMutableArray *sqliteArray = [NSMutableArray array];
[sqliteArray addObject: @"CREATE TABLE IF NOT EXISTS SiteData (SITE_ID TEXT PRIMARY KEY NOT NULL, STA1 TEXT "
"TBM TEST, SITE_DESC TEXT, REMARKS TEXT, LOOP_COUNT INTEGER, DATE TEXT)" ];
[sqliteArray addObject: @"INSERT INTO SiteData (SITE_ID, LOOP_COUNT) VALUES('','')"];
[sqliteArray addObject: @"CREATE TABLE Readings (SITE_ID TEXT REFERENCES SiteData, LOOP_NBR TEXT, LOOP_CLOSED BINARY, "
"SEQ INTEGER, STA TEXT, BS TEXT, FS TEXT, DESC TEXT, …Run Code Online (Sandbox Code Playgroud) 可能重复:
如何编写包含多个参数的方法/消息?
我在这里真的很困惑......我看过SO和Google,在那里我找到了一个用两个参数调用方法的例子.所以我修改了它供我使用,不幸的是我无法让它工作.这是我更新的代码:
- definition of method
- (NSArray *) fetchEventsBetweenDates: (NSDate *) sDate: andDate: (NSDate *) eDate;
- definitions and creation of sD and eD
// convert start dates to NSDate
NSDateFormatter* df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"MM/dd/yyyy"];
NSDate* sD = [df dateFromString:@"10/03/2012"];
NSLog(@"startDate: %@", sD);
// convert end dates to NSDate
NSDate* eD = [df dateFromString:@"10/05/2012"];
NSLog(@"endDate: %@", eD);
- call to method
[self.eventsList addObjectsFromArray:[self fetchEventsBetweenDates: sD andDate: eD]];
- method
- (NSArray *) fetchEventsBetweenDates: (NSDate *) …Run Code Online (Sandbox Code Playgroud) 我正在使用FMDB创建并向ad/b添加记录.创建d/b的方法是:
//----------------------- checkIfDatabaseExists -----------------|
+ (void) openCreateDB {
NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); // Get the path to the database file
NSString *documentPath = [searchPaths objectAtIndex:0];
NSString *databasePath = [documentPath stringByAppendingPathComponent:@"ppcipher.s3db"];
NSLog(@"d/b path: /%@", databasePath);
char * errmsg = nil;
NSFileManager *fileManager = [NSFileManager defaultManager];
[fileManager removeItemAtPath:databasePath error:NULL]; // <------------ delete d/b TESTING ONLY!
BOOL fileExists = [fileManager fileExistsAtPath:databasePath];
if(!fileExists) {
FMDatabase* _db = [FMDatabase databaseWithPath: databasePath];
if (![_db open]) {
NSLog(@"Could not open/create database");
}
[_db executeUpdate:@"CREATE TABLE …Run Code Online (Sandbox Code Playgroud) 我有一些代码在UITextView周围设置边框.它在一个类中正确构建; 当我接受该代码并将其复制到另一个类(更改对象名称)时,它不再构建,说"在前向类对象'CALayer*'中找不到"属性'borderWidth'(其他两行的相同消息)代码).我做了一个干净的,重新构建,没有任何帮助.为什么会这样?以及如何解决?
- (void)viewDidLoad {
[super viewDidLoad];
//-- draw box around notes field
orderNotes.layer.borderWidth = 1.0f;
orderNotes.layer.borderColor = [[UIColor blackColor] CGColor];
orderNotes.layer.cornerRadius = 4;
Run Code Online (Sandbox Code Playgroud)
}
对象"orderNotes"定义为UITextView.没有其他错误.
这是我的SQLite数据库的结构:

我试图删除属于选择OrderInfo.Cust_ID的所有OrderData,它属于特定的CustData.Cust_ID.这是我的DELETE语句,它给出了错误:"没有这样的列:CustData.Customer_ID"
DELETE FROM OrderData
WHERE CustData.Customer_ID = OrderInfo.Cust_ID
AND OrderData.Order_ID = OrderInfo.Order_ID
AND CustData.Bus_Name = 'Albertsons'
Run Code Online (Sandbox Code Playgroud)
我知道SQLite不支持DELETE语句中的JOIN,所以我留下了WHERE和ANDs; 有人可以告诉我正确的方法吗?
我有一个UIWebView,我在其中显示一个包含外语内容的HTML文件(在本例中为法语),由Google翻译.
原文英文是:
清除 - 用于停止所有计时器并清除显示在视图最右侧的数量.
谷歌的翻译是这样的:
Effacer - permetd'arrêter的旅游景点和旅游景点,其中包括de la vue.
当法语是本地化语言时,这就是iPhone模拟器中显示的内容:

这是我用来加载它的代码:
// determine what the language for this locale is...
NSString *sysLangCode = [[NSLocale preferredLanguages] objectAtIndex:0];
// contatenate the language code to the filename
NSURL *indexURL = [[NSBundle mainBundle] URLForResource: [NSString stringWithFormat:@"instRST-%@", sysLangCode]
withExtension:@"html"];
// load it...
[webView loadRequest:[NSURLRequest requestWithURL:indexURL]];
Run Code Online (Sandbox Code Playgroud)
我查看过谷歌,SO和UIWebView,找到任何可以正确渲染的设置.使用的字体是Verdana.
我该怎么做才能正确渲染?
我的应用程序适用于使用两个场景的故事板的iPad.在一个场景中,我有一个包含UIVIew的UIScrollView.它滚动,但立即反弹,使自己无用.UIScrollView的大小是768x590; UIView的大小是768x1590; UIScrollView的ContentSize为768x590.这是UIScrollView设置的图像:

(我在过去的6个小时里看过SO和Google,尝试了很多东西,但没有任何效果.我也做了几次CMD + Option + K(Clean),但这也没有用.
为什么它不能正确滚动?
我有一个iPad应用程序(XCode 4.6,iOS 6.2,Storyboards,ARC),我创建了一个UIViewController(未连接到任何segue),用于UIPopover.这些是ViewController设置:


我有这个代码,应该在UIPopover中显示"viewForPopover"ViewController.
UIView *anchor = textField;
UIViewController *viewControllerForPopover =
[self.storyboard instantiateViewControllerWithIdentifier:@"viewForPopover"];
popover = [[UIPopoverController alloc]
initWithContentViewController:viewControllerForPopover];
[popover presentPopoverFromRect:anchor.frame
inView:anchor.superview
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Run Code Online (Sandbox Code Playgroud)
我的问题是:没有self.storyboard.那么我该如何到达当前类之外的视图控制器呢?(当前课程是UIView的子视图)
我有一个iPad应用程序(XCode5,ARC,Storyboards,iOS 7).这是问题(占位符和光标位于UITextField的中间):

这是创建它的代码:
- (IBAction)bSendFeedback:(UIButton *)sender {
// make the popover
UIViewController* popoverContent = [[UIViewController alloc] init];
UIView* popoverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 450, 500)];
popoverView.backgroundColor = [UIColor colorWithWhite:(CGFloat)1.0 alpha:(CGFloat)1.0]; // frame color?
popoverContent.view = popoverView;
//resize the popover view shown in the current view to the view's size
popoverContent.contentSizeForViewInPopover = CGSizeMake(450, 500);
// add the UITextfield to the popover
UITextField *tf = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, 450, 500)];
[tf becomeFirstResponder];
tf.delegate = self;
tf.tag = kSendFeedback;
tf.placeholder = @" …Run Code Online (Sandbox Code Playgroud) objective-c ×6
ios ×5
sqlite ×2
fmdb ×1
nsarray ×1
sql ×1
storyboard ×1
uipopover ×1
uiscrollview ×1
uitextfield ×1
uiwebview ×1
xcode ×1
xcode4 ×1
xcode4.6 ×1