Tag: cocoa触摸

工具栏上下button逻辑

我正在使用下面的代码移动到下一个领域使用UITextField委托,也是我添加一个工具栏的键盘与上一个,下一个和确定的button。 代码工作正常。 就像你看到的键盘返回button的逻辑是非常通用的,使用UITextField标签,这是很好的,因为我要使用一段代码。 现在我需要编写上一个和下一个button的逻辑,我迷路了。 有任何想法吗? 更新 (完整的代码,有一些修改,感谢@ 8vius,在聊天中花了一些时间,使其工作): // // SigninViewController.m // #import "SigninViewController.h" @implementation SigninViewController @synthesize firstResponder = _firstResponder; @synthesize toolbar; @synthesize email; @synthesize password; – (void)move:(UIBarButtonItem*)sender { NSInteger tag = self.firstResponder.tag; if ([sender.title isEqualToString:@"Anterior"]) { tag -= 1; } else if ([sender.title isEqualToString:@"Próximo"]) { tag += 1; } UITextField *nextTextField = (UITextField*)[self.view viewWithTag:tag]; […]

xcodebuild:cdtool无法编译:DataModelCompile /path/to/coredatamodel.xcdatamodeld dyld:找不到符号:_OBJC_CLASS _ $ _ OS_object

我正在构build一个Mac桌面/cocoa应用程序来存档我的iOS项目,核心实现使用NSTask与xcodebuild命令,其次是raywenderlich的这个指南 。 根本原因是CoreData模型文件编译,我用这个应用程序来build立我的另一个项目,没有包含任何CoreData文件,没有问题。 比较有趣的是,我在terminal上尝试了相同的xcodebuild命令,它就成功了! 然后,我开始比较两个xcodebuild输出,发现一些差异, 在terminal, DataModelCompile /Users/hanwei/Library/Developer/Xcode/DerivedData/youYue3xMaster-cjatyqmgblwyoyccarejxlozikdi/Build/Intermediates/ArchiveIntermediates/youYue3xMaster/InstallationBuildProductsLocation/Applications/youYue3xMaster.app/ youYue3xMaster/LogicBook.xcdatamodeld cd /Users/hanwei/work/DragonSource/projects/ios_youyue3_xmaster/youYue3xMaster export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/opt/subversion/bin:/usr/local/bin:/opt/subversion/bin:/usr/local/bin:/opt/subversion/bin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin" /Applications/Xcode.app/Contents/Developer/usr/bin/momc –sdkroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk –iphoneos-deployment-target 7.0 –module youYue3xMaster /Users/hanwei/work/DragonSource/projects/ios_youyue3_xmaster/youYue3xMaster/youYue3xMaster/LogicBook.xcdatamodeld /Users/hanwei/Library/Developer/Xcode/DerivedData/youYue3xMaster-cjatyqmgblwyoyccarejxlozikdi/Build/Intermediates/ArchiveIntermediates/youYue3xMaster/InstallationBuildProductsLocation/Applications/youYue3xMaster.app/ 在我的cocoa应用程序的日志 DataModelCompile /Users/hanwei/Library/Developer/Xcode/DerivedData/youYue3xMaster-cjatyqmgblwyoyccarejxlozikdi/Build/Intermediates/ArchiveIntermediates/youYue3xMaster/InstallationBuildProductsLocation/Applications/youYue3xMaster.app/ youYue3xMaster/MagazineModel.xcdatamodeld cd /Users/hanwei/work/DragonSource/projects/ios_youyue3_xmaster/youYue3xMaster export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/usr/bin/momc –sdkroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk –iphoneos-deployment-target 7.0 –module youYue3xMaster /Users/hanwei/work/DragonSource/projects/ios_youyue3_xmaster/youYue3xMaster/youYue3xMaster/MagazineModel.xcdatamodeld /Users/hanwei/Library/Developer/Xcode/DerivedData/youYue3xMaster-cjatyqmgblwyoyccarejxlozikdi/Build/Intermediates/ArchiveIntermediates/youYue3xMaster/InstallationBuildProductsLocation/Applications/youYue3xMaster.app/ dyld: Symbol not found: _OBJC_CLASS_$_OS_object Referenced from: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk/usr/lib/system/libxpc.dylib Expected in: /usr/lib/system/introspection/libdispatch.dylib in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk/usr/lib/system/libxpc.dylib 2016-06-17 09:46:28.158 momc[76594:13533677] […]

推送通知和后台获取模式

这是我的理解,系统将要么从closures或在后台运行,并允许您提取之前,它显示系统警报给用户。 我必须下载一些数据以显示用户何时点击推送通知。 我看到我的提取活动正在执行,而推送显示给用户。 在我们完成数据提取之前,允许用户点击通知并启动应用程序。 它是否正确?

iOS – 从作为parameter passing的块中获取variables

我已经有一段时间对此感到震惊,但似乎无法find我正在寻找的东西。 基本上我在A类中有下面的方法声明 – (void)doSomethingCoolWithThisBlock:(void (^)(void))block 在B类中,当我在块部分调用这个方法如下: UILabel *myLabel = [[UILabel alloc] init]; UITextField *myField = [[UITextField alloc] init]; 等等 我的问题是,在我的doSomethingCoolWithThisBlock的实现中,我怎么能剖析块内的东西,并得到说UILabel例如?

在自定义的UINavigationBar中绘制,附在顶部

我有一个UINavigationBar的子类。 它的barPosition是UIBarPositionTopAttached 。 比我重写-(void)drawRect:(CGRect)rect在我的子类。 作为参数的rect总是有44像素的高度,而且我只能在这个矩形内部绘制。 所以,我不能执行绘图状态栏,它有默认的外观。 如果我评论 – -drawRect ,看起来如预期,导航栏和状态栏看起来整体,并有64像素的高度。 有没有一种方法来实现这个效果与-drawRect:在UINavigationBar子类?

设置应用程序closures时报警

我如何设置本地通知,强迫用户打开应用程序。 我需要我的应用程序为日出和日落设置本地通知,但我不想问人打开应用程序。 我知道我可以通过scheduleLocalNotification多达64个通知,但我需要设置它一年,所以我应该能够在后台运行的应用程序,并为未来的日出和日落在后台设置警报。

iOS Core Data获取新插入的,尚未保存的对象

我必须在批处理(导入过程)中的CoreData实体中创build一些数据,我想在最后“提交”或“回滚”一个错误(因此保存之间将不起作用)。 问题是我例如需要创build一个实体“人”,并在以后的进展中,我需要重新使用该实体。 但它可以在这个过程之前已经存在,或者可以在这个导入过程中创build。 所以我试图用谓词“(personId == 4711)”来获取它。 但是,虽然我已经设置了[fetchRequest setIncludesPendingChanges:YES]; 它没有find新创build的Person对象。 我读到这个问题 , 这个答案是哪个状态,这是不可能的? 我对吗? 如果是这样,我该如何解决/处理这个?

如何使iPad上的模式视图上的翻转animation在后台透明?

如何使我的翻转animation透明,以便它后面的视图显示? 这是我的一些代码: EditInfoViewController *editController = [[EditInfoViewController alloc] initWithNibName:@"EditInfoViewController" bundle:nil]; editController.delegate = self; UINavigationController *editNavController = [[UINavigationController alloc] initWithRootViewController:editController]; editNavController.modalPresentationStyle = UIModalPresentationCurrentContext; editNavController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self.navigationController presentModalViewController:editNavController animated:YES]; 一张照片值1000字(这是在翻页animation中拍摄的):

localizedCaseInsensitiveContainsString在Swift中不可用

我试图使用iOS 8中引入的localizedCaseInsensitiveContainsString()方法: let match = text.localizedCaseInsensitiveContainsString(searchText) Swift编译器说: 'String'没有名为'localizedCaseInsensitiveContainsString'的成员 文档说: Swift在Stringtypes和NSString类之间自动桥接。 那么,这是怎么回事? 我知道我可以使用(title as NSString) 。 我只是想知道为什么。

UITableView reloadData不能正常工作的时候把它放在Editing Did End IBAction中,知道为什么

我在表格的每个单元格中放置了一个文本字段。 编辑文本字段后,将触发EditingDidEnd事件。 在处理这个事件的方法中,我尝试使用 [XXXUITableViewController.tableView reloadData]; 但它不起作用(委托方法没有被调用)。 如果我尝试像hanlding Tapgesture一样重新加载数据,它的工作就好了。 我可以使用anthoer的方式来使我的应用程序工作,但最好知道为什么reloadData不工作。 任何想法,非常感谢。 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"ParCellID"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; for(UIView * old in cell.contentView.subviews){ [old removeFromSuperview]; } //add a textfield in Table Cell View ParticleConfigCellView * parCell=[[[NSBundle mainBundle] loadNibNamed:@"ParticleConfigCellView" owner:self options:nil]objectAtIndex:0]; [parCell refreshFromDataSource:[self.dataContainer.data_particleConifig objectAtIndex:indexPath.row]]; [cell.contentView addSubview:parCell]; […]