Tag: cocoa touch

将parameter passing给addTarget:action:forControlEvents

我正在使用addTarget:action:forControlEvents像这样: [newsButton addTarget:self action:@selector(switchToNewsDetails) forControlEvents:UIControlEventTouchUpInside]; 我想将parameter passing给我的select器“switchToNewsDetails”。 我成功做的唯一的事情是通过写(ID)发送者: action:@selector(switchToNewsDetails:) 但我想传递整数值的variables。 用这种方式来写就行不通了: int i = 0; [newsButton addTarget:self action:@selector(switchToNewsDetails:i) forControlEvents:UIControlEventTouchUpInside]; 用这种方式写这个也不行: int i = 0; [newsButton addTarget:self action:@selector(switchToNewsDetails:i:) forControlEvents:UIControlEventTouchUpInside]; 任何帮助将不胜感激:)

项目构build中的CocoaPods错误

我无法build立一个使用CocoaPods的项目。 我得到以下错误: diff: /../Podfile.lock: No such file or directory diff: Manifest.lock: No such file or directory error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.` $ pod install似乎工作正常,并将Pods项目添加到我的工作区。 我试过$ pod update但这没有帮助。 看来PODS_ROOT没有被设置。 Podfile: platform :ios, '6.0' workspace 'Example.xcworkspace' xcodeproj 'example/Example.xcodeproj' pod 'TestFlightSDK', '~> 1.3.0-beta.5' pod 'TestFlightLogger', […]

IOS中的循环进度条

我想创build一个如下的圆形进度条: 我如何使用Objective-C和Cocoa来做到这一点? 我如何开始做这个工作是创build一个UIView和编辑drawRect,但我有点失落。 任何帮助将不胜感激。 谢谢!

RootViewController切换转换animation

有什么办法有一个过渡/animation效果,而用一个新的appDelegatereplace现有的viewcontroller作为rootviewcontroller?

在UIScrollView中滚动UITableView

我有一个UITableView是UIView的子视图,那么UIView是一个UIScrollView的子视图。 如何检测应该滚动UITableView的触摸? UITableView可以获得项目select事件(表格中的一个单元格被选中/点击),除非在单元格被触发之前必须按住单元格。 但我不能让UITableView滚动,它始终是对平移手势作出反应的UIScrollView 。 任何帮助是极大的赞赏。 提前致谢! 编辑:解决了,但我问了错误的问题。 它在罗马K指出默认情况下工作。 我认为这个问题与UITableView的一部分在UIScrollView的边界之外有关( UITableView超出了UIScrollView的底部边界)。 设置它正确适合里面的UIScrollView修复它。

读取和写入图像到SQLite数据库的iPhone使用

我已经build立了一个SQLite数据库,当前读写NSString s是完美的。 我也想将图像存储在数据库中,稍后再调用它。 我已经读了一些使用NSData和编码图像,但我不完全知道什么语法是我想要做的。 任何代码片段或例子将不胜感激。 我当前的过程是这样的: UIImagePickerController – >用户从照片中select图像 – > chosenImage被设置为UIImageView实例 – > 现在我想把这个图像,并将其存储在数据库 我应该提到这个调用最终会被一个远程服务器调用所取代。 不知道这是否会影响性能。

将UIImage转换为NSData

我在我的应用程序中使用这个代码,这将帮助我发送图像。 但是,我有一个图像的图像视图。 我没有档案,但有我的形象在我身边。 我如何更改下面的代码? 谁能告诉我如何将myimage转换为NSData ? // Attach an image to the email NSString *path = [[NSBundle mainBundle] pathForResource:@"rainy" ofType:@"jpg"]; NSData *myData = [NSData dataWithContentsOfFile:path]; [picker addAttachmentData:myData mimeType:@"image/jpeg" fileName:@"rainy"];

如何在Objective-C中进行string转换?

我想将一个string转换成一个双精度,并在做了一些math运算后,将其转换回一个string。 我如何在Objective-C中做到这一点? 有没有办法将一个double加到最接近的整数呢?

支持iOS Mail和Safari应用程序中的Open In …菜单项

我需要使用UIDocumentInteractionController类中的“Open In …”事件,从Safari和Mail应用程序中打开我的应用程序。 我如何做到这一点?

如何调整UIModalPresentationFormSheet的大小?

我想显示一个模式视图控制器作为UIPresentationFormSheet。 该视图出现,但我似乎无法调整它。 我的XIB具有适当的高度和宽度,但是当我这样称呼它时似乎会被覆盖: composeTweetController = [[ComposeTweet alloc] initWithNibName:@"ComposeTweet" bundle:nil]; composeTweetController.modalPresentationStyle = UIModalPresentationFormSheet; [self presentModalViewController:composeTweetController animated:TRUE]; 有什么想法吗? 我正在使用iPhone SDK 3.2 beta 4