Friday, June 10, 2011

iOS Cheat Sheet

The App Icon of an iPad Application is 72x72 pixels. Get all icon sizes here and advice here. Remove the shine effect from the iPad App Icon as follows:

Info.plist > Open As > Source Code >


Run your App only in landscape mode:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{ return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft); }

Remove the Status Bar:

Info.plist > Open As > Source Code >


To add a background image to your application, do the following in your AppDelegate didFinishLaunching, where wall1.png is a 1024x760 vertical wallpaper, and mainView is your view controller.

self.window.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"wall1.png"]];
self.mainView.view.backgroundColor = [UIColor clearColor];

It seems you can only customize the font of your labels programmatically. See Creating a UILabel programmatically for some sample code that you could drop in your viewDidLoad.

Iterate (for loop) over a string array:

NSArray * words = [NSArray arrayWithObjects:@"one",@"two",@"three",nil];
for(NSString * str in words) {

When you need a custom colour for your app, you can provide a getter that allocs the custom color into a static on first use. Details here.

{ "loggedin": false, "owner": false, "avatar": "", "render": "nothing", "trackingID": "UA-36983794-1", "description": "Examples and common steps required during iOS development.", "page": { "blogIds": [ 53 ] }, "domain": "", "base": "\/michael", "url": "https:\/\/\/michael\/", "frameworkFiles": "https:\/\/\/michael\/_framework\/_files.4\/", "commonFiles": "https:\/\/\/michael\/_common\/_files.3\/", "mediaFiles": "https:\/\/\/michael\/media\/_files.3\/", "tmdbUrl": "http:\/\/\/", "tmdbPoster": "http:\/\/\/t\/p\/w342" }