How to switch to different Storyboard for iPhone 5?

I was looking for the same answer couple of weeks ago here’s my solution hope helps.. -(void)initializeStoryBoardBasedOnScreenSize { if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) { // The iOS device = iPhone or iPod Touch CGSize iOSDeviceScreenSize = [[UIScreen mainScreen] bounds].size; if (iOSDeviceScreenSize.height == 480) { // iPhone 3GS, 4, and 4S and iPod Touch 3rd and … Read more

iPhone: AVAudioPlayer unsupported file type

At long last i have found a solution to this problem! Instead of initializing the audio player with the NSData object, I saved the file to the Documents folder, and then initialized the player with the file URL //download file and play from disk NSData *audioData = [NSData dataWithContentsOfURL:someURL]; NSString *docDirPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) … Read more

What does the text inside parentheses in @interface and @implementation directives mean?

Those are called Categories and allow you to add further functionality to your classes. A category allows you to add methods to an existing class—even to one for which you do not have the source. Categories are a powerful feature that allows you to extend the functionality of existing classes without subclassing. Using categories, you … Read more

Add lefthand margin to UITextField

You can do it by extending UITextField class and overriding two methods: – (CGRect)textRectForBounds:(CGRect)bounds; – (CGRect)editingRectForBounds:(CGRect)bounds; Here is the code: The interface in MYTextField.h @interface MYTextField : UITextField @end Its implementation in MYTextField.m @implementation MYTextField static CGFloat leftMargin = 28; – (CGRect)textRectForBounds:(CGRect)bounds { bounds.origin.x += leftMargin; return bounds; } – (CGRect)editingRectForBounds:(CGRect)bounds { bounds.origin.x += leftMargin; … Read more

Correct implementation of parent/child NSManagedObjectContext

The parent/child MOC model is a really powerful feature of Core Data. It simplifies incredibly the age-old concurrency problem we used to have to deal with. However, as you’ve stated, concurrency is not your issue. To answer your questions: Traditionally, you use the NSMainQueueConcurrencyType for the NSManagedObjectContext associated with the main thread, and NSPrivateQueueConcurrencyTypes for … Read more

How much delay of ios push notification?

Push notifications are unreliable and cannot be guaranteed that they have been delivered. It all depends on the apple APNS server, that said, usually when I send a push notification I get the result in under a few seconds. More Information: They are not reliable! There is no guarantee that push notifications will actually be … Read more

How to change the Color of text in UITabBarItem in iOS 5

Do you mean this one? Keep in mind, this only works for iOS5.0 or later. if ([self.tabBarItem respondsToSelector:@selector(setTitleTextAttributes:)]) { NSLog(@”*** Support method(iOS 5): setTitleTextAttributes:”); [self.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIFont fontWithName:@”AmericanTypewriter” size:20.0f], UITextAttributeFont, [UIColor blackColor], UITextAttributeTextColor, [UIColor grayColor], UITextAttributeTextShadowColor, [NSValue valueWithUIOffset:UIOffsetMake(0.0f, 1.0f)], UITextAttributeTextShadowOffset, nil]]; } Apple’s documentation on customizing appearance: In iOS v5.0 and later, you can … Read more