objective-c

Crash involving UISearchDisplayController rotating?

My app seems to crash sometimes when I rotate the phone. ViewControllerA has a UISearchDisplayController. ViewControllerA pushes ViewControllerB onto the nav stack. Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x00000000, 0x00000000 Crashed Thread: 0 Thread 0 Crashed: 0 libSystem.B.dylib 0x000791d0 __kill + 8 ...

Can I specify a specific superclass requirement for a class type variable?

I'm making a class that initializes instances of certain classes. This class will be used to initialize a few different types of classes all subclassed from a common super class. Currently I am using an instance variable: Class templateClass; to store the class type. I get compiler warnings saying methods aren't supported by templa...

Is delegation the preferred way to do this?

I have an UIViewController subclass that allows the user to add a new model object, in this case a bank account. I named the view controller AddBankAccountViewController. The user can enter the account number, an account label and the bank of the account, but this is all done in separate view controllers. I'm using delegation to let Add...

Objective-C how to print out leading 0 for a float?

How do you print out leading zeros for a float using NSString type? Input: 3.14 Desired Output: 03.1 Using Format: @"%02.1f" Output is 3.1 ...

Programmatically changing viewControllers

From my navigationController I have two paths: navigationController --> ViewControllerA -- ViewControllerB (currently showing). and navigationController --> ViewController1 -->ViewController2. I want to go from ViewControllerB to ViewController2. Here's what I tried: [self.navigationController popToRootViewControllerAnimated:YES]; /...

Classes Superclasses Subclasses

I'm trying to make two subclasses a class: // Old code - (void)setPaging { [pagingScrollView addSubview:self.ImageScrollView]; } @interface ImageScrollView : UIScrollView <UIScrollViewDelegate> { UIView *imageView; NSUInteger index; } @property (assign) NSUInteger index; - (void)displayTiledImageNamed:(CGPDFPage...

How to add a tag/group in the calendar in iPhone?

Hi, everyone, I want to ask a question about the iPhone application. I want to write a application to let the user to enter their activities in a page. For example, the activity name, date, time, group. After then, I want to add event in the iPhone calendar. However, I find that it is impossible to add the group in the iPhone. Therefor...

NSString length limit

How can I limit the length of a NSString? I would like to keep it below to equal to 100 characters/ ...

Memory of the Contacts on iPhone?

Hi, everyone, I want to ask a question about the Contacts on objective C. I am writing a program which will add the people to the iPhone build-in Contacts by ABPerson. However, I don't know I can add how many users to the iPhone. Are there some limitations of adding the contacts to the address book? I mean the number of user, adding fie...

How to run the program regularly?

Hi, everyone, I want to ask a question about the iPhone application. I am writing a program which can upload some information to a server. However, the user has to click a button before the upload. Therefore, is it possible for the application to upload the data to server regularly after the user only click one time of the button? It m...

KVC array: getters vs indexed accessors?

I'm confused by this: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/AccessorConventions.html#//apple_ref/doc/uid/20002174-178830-BAJEDEFB Supposing @interface Office : NSObject { NSMutableArray *employees; } What is the benefit of implementing the collection accessors? How is [anOffi...

Flipboard or iBooks style animation

Are there any examples out there to emulate page turning like iBooks or Flipboard? ...

Objective-C pre-compilation error

Hi all, I'm compiling a big iPhone app and am getting 24 of the same error... cc1plus: note: obsolete option -I- used, please use -iquote instead cc1: error: -I- specified twice This error is repeated 24 times for the same prefix header file. Any idea what's going on? Thanks! ...

Objective-C to plain c iPhone game performance improvements

I'm testing a 2D OpenGL ES based iPhone game on both the iPhone 3G and the iPhone 4. It runs great on the iPhone 4... and pretty well on the 3G. The game state is updated at 60 Hz... and the rendering is done at 60 fps. Would the following conversion from Objective-C to c improve the performance at all? // current Objective-C functio...

Release controller, but keep empty pointer?

I have a variable, editForm, that is used as a pointer to a view controller. Later on, I use a delegate method to release editForm when the user taps the button to close the view. @implementation EditViewController EditFormViewController *editForm; [...] (void)openeditform:(NSString*)editId { editForm = [[EditFormViewController ...

How to download an audio file from internet and play it using AvAudioplayer in Iphone sdk?

I need to download an audio file from the net and want to play it Using AVAudioPlayer.can any one give me suggestions how to do this. ...

Check whether a zip file is protected by password in Objective-C/iPhone?

Hello friends, I'm using lib ZipArchive to unzip file on iPhone, it works pretty well, however I met a issue about checking if a zip file is protected by password. I'm wondering if there's a function to check whether a zip file is protected by password before unzipping, but I didn't get lucky to find an api for that. So does anyone wh...

How to get status bar images in iPhone APP

I want to get status bar images without UIGetScreenImage() because this method is Private API. Apple recommend http://developer.apple.com/iphone/library/qa/qa2010/qa1703.html as a alternate solution, but this way can't get status bar images. Would like to know how to get status bar images? ...

How to enumerate volumes on Mac OS X?

I am not very proficient in Mac OS X programming, but I am working on a Qt application which needs info about the storage devices. Basically a list of hard drives and USB thumb drives. The end result should be like a vector which contains the following info for each device: string: Label string: Mount point string: Device description (a...

How to set tag to a button?

I am using [button.tag] = 50; But it is not working. I want to set tag to buttons. ...