Create Simple Single View For An Application
Create the application
Create view file
Menu > File > New > File > iOS > Cocao Touch > Objective-C class > Next
Subclass Of: UIViewControllerSubClass
Name it ("#ViewController", ending with "_iPhone" and "_iPad" for multi device apps, is a good naming convention)
Subclass of > UIViewController (or UITableViewController)
With XIB for user interface = Checked
In MyApNameAppDelegate.m add:
#import "#ViewController.h"
In MyApNameAppDelegate.m add to didFinishLaunchingWithOptions:
//----- CREATE VIEW -----
#ViewController *vc1 = [[#ViewController alloc] init];
[self.window addSubview:[vc1 view]];
//Show the window
[self.window makeKeyAndVisible];
Useful Methods To Add
//**************************************
//**************************************
//********** VIEW WILL APPEAR **********
//**************************************
//**************************************
//View about to be added to the window (called each time it appears)
//Occurs after other view's viewWillDisappear
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
//****************************************
//****************************************
//********** VIEW DID DISAPPEAR **********
//****************************************
//****************************************
//View has been dismissed, covered or otherwise hidden from view (called each time it disappers)
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
//*************************************
//*************************************
//********** VIEW DID UNLOAD **********
//*************************************
//*************************************
- (void)viewDidUnload
{
[super viewDidUnload];
//[SomeObject release];
//SomeObject = nil;
}
//*****************************
//*****************************
//********** DEALLOC **********
//*****************************
//*****************************
- (void)dealloc
{
//[SomeObject release];
[super dealloc];
}