Tag: cocoa touch

是否有可能以编程方式生成核心数据结构?

我目前正在开发一个项目,这个项目可能需要能够根据描述每个对象的JSON提要自动生成一个Core Data模型和类,它是属性和关系。 这将使我们的公司能够在每个项目开始时从我们的客户关系pipe理中快速生成一个工作核心数据库。 这可能/容易实现? 如果是这样,有没有人有任何提示我可以开始? 我已经创build了各种使用Core Data的iOS应用程序,但是我从来没有创build过需要自动创buildCore Data模型的iOS应用程序。

设备被locking时,AVAudioPlayer不会播放

我在我的应用程序中使用AVAudioPlayer 。 当我select一首正在播放的歌曲时,但是我的问题是,当设备被locking时,它不会播放。

NSNotifications的开销

我最近开始使用NSNotification s: [[NSNotificationCenter defaultCenter] postNotificationName: selector: object:]; …. 我觉得这是一个很好的概念之间的视图控制器之间进行通信。 对于应用程序中的所有通信,使用NSNotification似乎有点太简单了。 如果我在我的应用程序的大部分工作中使用了NSNotification ,那么您认为太多的开销会是什么?

通过使用自动引用计数问题隐式转换指针来获取错误

我得到一个错误一个Objective-C指针隐式转换为'无效'与ARC是不允许的 -(void)openAnimation { NSValue *contextPoint =[NSValue valueWithCGPoint:self.view.center]; [UIView beginAnimation:nil context:contextPoint]; // getting error here } 任何人都可以帮我解决这个错误 谢谢

使用ARC项目中的非ARC库的方法?

我使用的是非常棒的非ARC项目: https : //github.com/boredzo/iso-8601-date-formatter 我试图从这个在ARC项目中是非ARC的库中使用下面的方法: – (NSDate *) dateFromString:(NSString *)string timeZone:(out NSTimeZone **)outTimeZone; 我努力了: group.updatedAt = [formatter dateFromString:someString timeZone:[NSTimeZone localTimeZone]]; group.updatedAt = [formatter dateFromString:someString timeZone:*__autorelease [NSTimeZone localTimeZone]]; group.updatedAt = [formatter dateFromString:someString timeZone:(*__autoreleasing [NSTimeZone localTimeZone]] *); group.updatedAt = [formatter dateFromString:someString timeZone:[[NSTimeZone localTimeZone] autorelease]]; 请注意,我对iOS相当新,所以我没有任何内存pipe理的经验。 但是,所有这些尝试,我收到以下错误信息: Implicit conversion of an Objective-C pointer to 'NSTimeZone *__autoreleasing *' is […]

UITableView,是否有可能在同一个单元格中使用左+右alignment2个string?

说我有一个string数组我在tableView中显示以下数据: 排名名称项目 第一个字段是一致的长度(4),但是中间字段是可变的,所以我希望能够做的是以某种方式拆分单元格,使得Item是正确的。 是否有捷径可寻? 排名名称项目 所以 Sarg Bobmarley magic Capt Huf axe Peon Yumkru sword 变 Sarg Bobmarley magic Capt Huf axe Peon Yumkru sword 细胞法: // Customize the appearance of table view cells. – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) […]

FbConnect:同时发布在用户的墙上和新闻源中?

我正在使用以下代码使用FbConnectlogin到Fb: – (IBAction)loginButtonClicked:(id)sender { facebook = [[Facebook alloc] initWithAppId:@"355949667779777" andDelegate:self]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if ([defaults objectForKey:@"FBAccessTokenKey"] && [defaults objectForKey:@"FBExpirationDateKey"]) { facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"]; facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"]; } if (![facebook isSessionValid]) { NSArray *permissions = [[NSArray alloc] initWithObjects: @"user_likes", @"read_stream", @"publish_stream", nil]; [facebook authorize:permissions]; [permissions release]; } } 然后我使用下面的代码发布到用户的墙上: – (IBAction)postToWallPressed:(id)sender { […]

将JavaScript注入到UIWebView中

我想使用stringByEvaluatingJavaScriptFromString:改变一个WebView,它不会像我期望的那样执行。 这里是代码,这JS虽然不执行。 任何想法为什么? UIWebView *wv = [UIWebView alloc] init]; NSURL *url = [[NSURL alloc] initWithString:@"http://www.google.com"]; NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; [wv loadRequest:request]; [wv stringByEvaluatingJavaScriptFromString:@"document.write('This Works')"];

如何在iOS中使用popup式菜单?

当我点击导航栏中的加号图标时,我想要使用popup式菜单,看起来像我附加的图片。 你能指导我怎么做到这一点? 谢谢一堆! 感谢帮助的人,我得到了我的答案,如果有人正在寻找一个直接链接到苹果文档这里是: https : //developer.apple.com/library/ios/documentation/UserExperience/Conceptual/UIKitUICatalog/ UIActionSheet.html#// apple_ref / DOC / UID / TP40012857,UIActionSheet

在iBooks中打开pdf的UIDocumentInteractionController崩溃

我有一个testingPDF文件,我想通过我的应用程序在iBooks中打开。 我将它保存在我的临时目录中,并使用此代码将其加载到iBooks: NSURL *targetURL = [NSURL fileURLWithPath:tempFullPath]; NSLog(@"Path is %@", tempFullPath); UIDocumentInteractionController *controller = [UIDocumentInteractionController interactionControllerWithURL:targetURL]; controller.delegate = self; controller.UTI = @"com.adobe.pdf"; [controller presentOpenInMenuFromRect:self.view.bounds inView:self.view animated:YES]; 菜单popup很好,但当我点击iBooksbutton的应用程序崩溃,并挂起我的Xcode。 我在NSLog输出中得到的文件的path如下所示: Path is /private/var/mobile/Applications/65EC4182-A79B-431C-9E74-BD72D91A31AB/tmp/TestFile.pdf 我究竟做错了什么? 提前致谢!