cocoa-touch

How to get all the application's ViewControllers in iOS?

吃可爱长大的小学妹 提交于 2020-01-11 09:51:18
问题 How can I get all the ViewControllers of my application at runtime? As far as I know self.navigationcontroller.viewControllers returns the NSArray of only those controllers which are on the navigation stack. But is there some way I can access all the my application's ViewControllers? 回答1: Hooking in on the answer of Umka. Without knowing exactly what you want to do, this might be totally overkill, but it might help you. You could subclass the UIViewController (e.g. the

Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1

 ̄綄美尐妖づ 提交于 2020-01-11 09:18:09
问题 I am getting following error when I am running my application on iPod touch (version 4.2.1). My app crashes after a point: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found). My XCODE version is 3.2.6 with IOS 4.3 and my deployment target version is 4.2. Any reason why this is so happening? 回答1: Sometimes I have similar problems, and what works for me is Clean and Build the

Can I use a UIBarButtonSystemItem for a UIButton?

落爺英雄遲暮 提交于 2020-01-11 08:34:09
问题 I am trying to customize a UIButton and I want to use a UIBarButtonSystemItem style that is available for a UIBarButtonItem object. How do I use a UIBarButtonSystemItem style on a UIBUtton object? 回答1: You can't. UIBarButton and UIButton are two completely different classes. The best you can do is find images close to what you're looking for and add them to UIButtons. 回答2: Use a UIView instead of a UIButton that contains a UIToolbar with UIBarButtonItems. UIView *buttonContainer = [[UIView

Error:Apple Mach-O Linker (Id) Warning

杀马特。学长 韩版系。学妹 提交于 2020-01-11 08:16:28
问题 In my app I have been working to import and export the database. I have imported some files which is required for this functionality but when i try to run the app in simulator the errors listed below occurs. I can't understand which type of errors are these. so plz help me solve this problem. Undefined symbols for architecture i386: "_inflateInit2_", referenced from: -[NSData(NSDataExtension) gzipInflate] in NSData+CocoaDevUsersAdditions.o "_inflate", referenced from: -[NSData(NSDataExtension

Error:Apple Mach-O Linker (Id) Warning

若如初见. 提交于 2020-01-11 08:14:06
问题 In my app I have been working to import and export the database. I have imported some files which is required for this functionality but when i try to run the app in simulator the errors listed below occurs. I can't understand which type of errors are these. so plz help me solve this problem. Undefined symbols for architecture i386: "_inflateInit2_", referenced from: -[NSData(NSDataExtension) gzipInflate] in NSData+CocoaDevUsersAdditions.o "_inflate", referenced from: -[NSData(NSDataExtension

Receiving Error Domain=kCFErrorDomainCFNetwork Code=2 when attempting to read from ReadStream

我与影子孤独终老i 提交于 2020-01-11 08:11:09
问题 I'm attempting to synchronously read from a CFReadStream objected created by CFStreamCreatePairWithSocketToHost . The stream opened fine but when I attempt to invoke CFReadStreamRead on it in a loop, CFReadStreamRead() returns -1 and the resulting error is: Error Domain=kCFErrorDomainCFNetwork Code=2 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 2.)" UserInfo=0x14a920 {kCFGetAddrInfoFailureKey=8} I'm also receiving this same exact error when using this ReadStream

Passing a dictionary between two viewcontrollers?

喜夏-厌秋 提交于 2020-01-11 07:50:15
问题 I have an application in which I have a webservice call that returns data as a dictionary. I want to access this dictionary in another view controller for loading the values into a table. Can anybody demonstrate how to pass this response dictionary from one view controller to another? 回答1: You could define an NSDictionary property in your AnotherViewController and set it from the previous controller. I'll give a brief example below. //.h @interface AnotherViewController { NSDictionary *data;

Erase line drawing with UIBezierPath

二次信任 提交于 2020-01-11 06:42:11
问题 Did a simple application for line drawing with UIBezierPath, but now need a way to erase the line drawn with UIBezierPath. Is there a way to implement eraser feature for removing the line painting? 回答1: If you are using an image as background then you can set the same image as brush pattern to draw the bezierpath it will virtually give you the eraser effect. It works for me. :) brushPattern=[[UIColor alloc]initWithPatternImage:[UIImage imageNamed:@"image.jpg"]]; // Here image.jpg is you

Mapkit, how to detect annotations have loaded

江枫思渺然 提交于 2020-01-11 06:30:29
问题 I want the annotations callout to popup when the pin has finished it's drop animation. Currently I am able to simulate it with the following method: - (void)showCallOut { [myMapView selectAnnotation:[myMapView.annotations objectAtIndex:0] animated:YES]; } In my viewDidLoad is where my annotation is created [myMapView addAnnotation:annotation]; The problem is that you simply can't callout [self showCallOut]; after that because at run time it responds before MapKit has "acknowledged" the

Why does changing a mutable array contained in a dictionary not require updating the dictionary?

前提是你 提交于 2020-01-11 06:28:07
问题 I was trying a piece of code from CS193P course (Objective-C). I noticed something in the way that the compiler works. An NSMutableArray called photos was added to an NSMutableDictionary , photosByPhotographer . Later on, a change was made to photos without any changes to photosByPhotographer . When I logged photosByPhotographer , the change was automatically applied to it and it did not need any extra lines of code! I wonder how the compiler makes this work? Any materials to read from? The