Supported iOS Fonts http://bees4honey.com/blog/tutorial/ios-fonts-iphone-4-and-ipad-fonts-list/ http://iphonedevelopment.blogspot.com/2010/08/fonts-and-font-families.html
All posts by
Using Fonts
Examples cell.textLabel.font = [UIFont boldSystemFontOfSize:18]; cell.detailTextLabel.font = [UIFont systemFontOfSize:14];
Designing Separate Views For Landscape And Portrait
This guide is based on the excellent guide provided by Geoff Palin at A Series of Tubes. Create View Controller Files Create your View Controller as normal so you end up with a ‘.h’, ‘.m’ and ‘.xib’ file names something like #ViewController_iPad.#. In #ViewController_iPad.h @interface #ViewController_iPad : UIViewController { IBOutlet UIView *mainPortraitView; IBOutlet UIView *mainLandscapeView; […]
Add Background Image
You can simply insert an Image Control onto a view, set it to fill the background and set it's image. Dealing With Different Screen Resolutions Create a single image using the maximum resolution required (at the time of writing 1242×2208 for iPhone 6 Plus for an iPhone only app or 2048 x 2048 for a iPhone […]
UISwitch Genreal
Using A Switch Declare in the .h IBOutlet UISwitch *MySwitch; In #ViewController.m //If view could be unloaded //********** VIEW DID UNLOAD ********** – (void)viewDidUnload { [super viewDidUnload]; [MySwitch release]; MySwitch = nil; } //********** DEALLOC ********** – (void)dealloc { [MySwitch release]; [super dealloc]; } Setting Switch Properties [MySwitch setOn:YES animated:YES]; if (MySwitch.on) NSLog(@"switch state: on"); […]
Using Images In Buttons
Designing Graphics Use a 10px rounded corner for iPhone and iPad button graphics if you want to match the standard button shape. If not set the button 'Type' to 'Custom' so that is become transparent other than your image. Dealing with iPhone4 vs iPhone3 resolutions You can list any image as [email protected] along with Image.png […]
Using Segmented Control
Define in the #ViewController.h file @interface #ViewController_iPhone : UIViewController { IBOutlet UISegmentedControl *mySegmentedControl; } – (IBAction)mySegmentedControlChanged:(id)sender; In the #ViewController.m file – (IBAction)mySegmentedControlChanged:(id)sender { } Connect In Interface Builder Right click Segmented Control, select ‘Value Changed’ and drag button onto ‘Files Owner’, select mySegmentedControlChanged Right click ‘Files Owner’ and select the ‘mySegmentedControl’ outlet and drag onto […]
Create Simple Scrolling View
Setting The Whole View As Scroll View Create a new ViewController as normal and drag on a Scroll View object. In The #ViewController.h File IBOutlet UIScrollView *MainScrollView; In The #ViewController.m File //*********************************** //*********************************** //********** VIEW DID LOAD ********** //*********************************** //*********************************** – (void)viewDidLoad { [super viewDidLoad]; //—– SET THE SCROLL VIEW SIZE —– MainScrollView.contentSize = CGSizeMake(320,1000); […]
Playing Audio
In #ViewController.h #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> @interface #ViewController_iPhone : UIViewController <AVAudioPlayerDelegate> { AVAudioPlayer *audioPlayer; Play File //————————— //—– PLAY AUDIO FILE —– //————————— if (audioPlayer) [audioPlayer release]; NSError *error; NSString *path; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); path = [[paths objectAtIndex:0] stringByAppendingPathComponent:@”MediaFiles”]; path = [path stringByAppendingPathComponent:@”MyFile.wav”]; audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL URLWithString:path] error:&error]; audioPlayer.delegate = […]
Drawing Graphics On A View
To draw graphics on the view you have to create a subclass of the UIView object and override the drawRect method. Do this as follows: Create The Subclass File New File Select the ‘Objective-C’ class icon and click Next. Change the Subclass of: option to ‘UIView’ and click Next Save the class (e.g. name as […]