Created
September 19, 2013 03:18
-
-
Save yaoxinghuo/6618719 to your computer and use it in GitHub Desktop.
Controller 之间的切换
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DetailController *detailController=[[DetailController alloc] initWithNibName:@"DetailController" bundle:nil]; | |
self.view.window.rootViewController=detailController; | |
//another: | |
TwoViewController *tempTwoViewController = [[TwoViewController alloc] initWithNibName:@"TwoViewController" bundle:nil]; | |
[self.view.superview addSubview:tempTwoViewController.view]; | |
[self.view removeFromSuperview]; | |
[tempTwoViewController release]; | |
//方法一右侧进入 | |
[self.navigationController pushViewController:fvc animated:YES]; | |
//返回到上一个 | |
[self.navigationController popViewControllerAnimated:YES]; | |
//另一种方法从下面切入 | |
SecondViewController* svc=[[SecondViewController alloc]init]; | |
[self.navigationController presentModalViewController:svc animated:YES]; | |
[svc release]; | |
//返回到上一个UIViewController | |
[self.navigationController dismissModalViewControllerAnimated:YES]; | |
//2.如果没有导航栏NavigationController的话 也是可以切换的 | |
SecondViewController* svc=[[SecondViewController alloc]init]; | |
svc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; | |
[self presentModalViewController:svc animated:YES]; | |
[svc release]; | |
//返回到上一个UIViewController | |
[self dismissModalViewControllerAnimated:YES]; | |
//也可以隐藏导航条,实际有一个 NavigatioController | |
TRYViewController *controller = [[TRYViewController alloc]init]; | |
UINavigationController *nav = [[TRYNavViewController alloc] initWithRootViewController:controller]; | |
self.window.rootViewController = nav; | |
//在自定义的 NavigationController 的viewDidLoad 中: | |
[self setNavigationBarHidden:YES]; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment