Window and Views General

Good Resources Apple View Programming Guide Control Sizes The minimum recommended size of a tappable UI element is 44×44 pixels. Background Color [[self view] setBackgroundColor:[UIColor blueColor]]; Background Image UIImageView *background = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@”background.png”]]; [self.view addSubview:background]; [background release]; Positioning Views This example moves a view down below the status bar: [self view].frame = CGRectMake(0, […]

Read More

Redraw Of The Window

In the same way that autorelease doesn’t occur until all of the current events and functions have been completed for your application, although the window and it’s object may be marked to be re-drawn it will not occur until the application returns to the background run loop.  At this point the OS checks to see […]

Read More

Status Bar

Hiding The Status Bar //HIDE THE STATUS BAR [[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];

Read More

Change Application Name

Up To Date Guide http://xcodebook.com/2011/04/renaming-projects/ Change Complete Project Name Menu > Project > Edit Active Target > Build tab Select ‘All Configurations’ from Configuration. Scroll down to the ‘Packaging’ group > Product Name Double click it and enter the new name. Build and run and the name has changed. Change The Displayed Name Changing the […]

Read More

Activity Indicator General

Drag onto window and place as requried Select and turn on ‘Hide When Stopped’ from it’s properties. Declare in #ViewController.h IBOutlet UIActivityIndicatorView *activityIndicator; In #ViewController.m //If view could be unloaded //********** VIEW DID UNLOAD ********** – (void)viewDidUnload { [super viewDidUnload]; [activityIndicator release]; activityIndicator = nil; } //********** DEALLOC ********** – (void)dealloc { [activityIndicator release]; [super […]

Read More

TextView General

TextView is the same as TextField apart from TextView allowing multi-line editing.  A TextView's Return key enters the newline character whereas a TextField's return key dispatches the delegate method 'textFieldShouldReturn'. Example Of Use Declaring in #ViewController.h file IBOutlet UITextView *MyTextViewName; Releasing in #ViewController.m file //************************************* //************************************* //********** VIEW DID UNLOAD ********** //************************************* //************************************* – (void)viewDidUnload […]

Read More

Text Field General

Text fields are for single line text.  For multi line text use Text View Delegates textFieldShouldReturn Keyboard return key pressed Example Of Use Declaring in #ViewController.h file IBOutlet UITextField *MyTextFieldName; Releasing in #ViewController.m file //********** VIEW DID UNLOAD ********** – (void)viewDidUnload { [super viewDidUnload]; [MyTextFieldName release]; MyTextFieldName = nil; } //********** DEALLOC ********** – (void)dealloc […]

Read More

Using Delegate Callback Functions

An Example Of Implementing The Location Services Framework Callbacks Include File You probably need to include the file for the class that will call you back via the delegate in your .h file: #import <CoreLocation/CoreLocation.h> Add The Delegate Definition To Your Class Declaration @interface WhereamiAppDelegate : NSObject <UIApplicationDelegate, CLLocationManagerDelegate> //A delegate is an input to […]

Read More

Adding A Framework To A Project

Adding A Framework To A Project Select the project at the top of the left navigator panel, select the target and then select the Build Phases tab. In the Link Binary with Libraries section click the ‘+’ button and then select the framework entry to add. The application can now use the classes and functions […]

Read More

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) Switch Between .m And .h Files Hold CTRL + ALT and press UpArrow (windows keyboard – Option+Command for Mac keyboard)

Read More