//代理类代码
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions
{
self.window = [[[UIWindowalloc]
initWithFrame:[[UIScreenmainScreen]
bounds]]autorelease];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColorwhiteColor];
[self.windowmakeKeyAndVisible];
RootViewController *rootViewController=[[RootViewControlleralloc]
init];
UINavigationController *uiNavigationController=[[UINavigationControlleralloc]
initWithRootViewController:rootViewController];
self.window.rootViewController=uiNavigationController;
return
YES;
}
//UIViewController代码
-(void) loadView{
UIView *baseView=[[UIViewalloc]
initWithFrame:[[UIScreenmainScreen]applicationFrame]];
baseView.backgroundColor=[UIColororangeColor];
self.view=baseView;
[baseViewrelease];
UIButton *btnShowSecond=[[UIButtonalloc]
initWithFrame:CGRectMake(100,100,
50, 20)];
[btnShowSecond setTitle:@"show"forState:UIControlStateNormal];
[btnShowSecond addTarget:selfaction:@selector(showVC)forControlEvents:UIControlEventTouchUpInside];
//btnShowSecond.backgroundColor=[UIColor blueColor];
[self.viewaddSubview:btnShowSecond];
}
-(void)showVC{
SecondViewController *secondViewController=[[SecondViewControlleralloc]
init];
[self.navigationControllerpushViewController:secondViewController
animated:YES];
[selfrelease];
}