Creating Simple Code Files
To create a .m and .h file pair to use for shared functions etc
Create Files
Menu > File > New File > Mac OS X > C and C++ > C File
(more…)
Declarations
Declaring Variables
Variables are declared inside { }
Declaring Methods
Methods are declared after }
Detect if device is iPad or iPhone
UIDevice* currentDevice = [UIDevice currentDevice];
if(currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad)
{
NSLog(@"This is an iPad");
}
else
{
NSLog(@"This is an iPhone");
}
Files
Project Files
.xib
MainWindow_iPhone.xib and MainWindow_iPad.xib contain the interface for your application. Double click to open in the interface builder.
General Tips
Show Help For Something In Code
Hold CTRL + ALTĀ and double click the name in your code (windows keyboard – Option+Command for Mac keyboard) (more…)
Getting App Version Number
Get Build Version Number
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]
Overview
xib doc window
File’s Owner
An instance of UIApplication – manages the event queue for your application
Triggering Device Functions
Open a webpage in safari
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com"]];



