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 >

<key>UIPrerenderedIcon</key>
<true/>

Run your App only in landscape mode:

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

Remove the Status Bar:

Info.plist > Open As > Source Code >

<key>UIStatusBarHidden</key>
<true/>

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) {
  NSLog(@"%@",str);
}

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.

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