UINavigationController(导航控制器)及跳转页面的方法
2015-09-01 17:56
417 查看
[self.navigationController pushViewController:_registVC animated:YES];
一.UINavigationController(导航控制器)
UINavigationController可以控制多个UIViewController
1.初始化一个UINavigationController
2.添加UINavigation
二.跳转页面的方法
1.从前往后跳转页面
2.从后往前跳转页面
//这个方法是返回前一个界面
- (UIViewController *)popViewControllerAnimated:(BOOL)animated;
// Returns the popped controller.
//这个方法是返回到在同一条链路上的任意一个界面
- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated;
// Pops view controllers until the one specified is on top. Returns the popped controllers.
//这个方法是返回到根视图
- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated;
// Pops until there's only a single view controller left on the stack. Returns the popped controllers.
一.UINavigationController(导航控制器)
UINavigationController可以控制多个UIViewController
1.初始化一个UINavigationController
<span style="font-size:14px;">self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds]; [self.window makeKeyAndVisible]; LoginViewController *loginVC = [[LoginViewController alloc]init]; UINavigationController *navigationVC = [[UINavigationController alloc]initWithRootViewController:loginVC]; self.window.rootViewController = navigationVC;</span>
2.添加UINavigation
//UIBarButtonItem继承于UIBarItem //1.初始化一个UIBarButtonItem UIBarButtonItem *btnItem = [[UIBarButtonItem alloc]initWithTitle:@"注册" style:UIBarButtonItemStyleDone target:self action:@selector(btnItemAction:)]; /* //2.title:修改UIBarButtonItem的名称 btnItem.title = @"adklfj"; //3.enabled:标识UIBarButtonItem是否为可编辑,其默认值为YES. btnItem.enabled = NO; //4.image:给UIBarButtonItem设置一张图片 btnItem.image = [[UIImage imageNamed:@"zx"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; */ //5.修改UINavigationController的title. self.navigationItem.title = @"登陆"; //6.navigationBarHidden:隐藏navigationController的导航栏,默认值是NO self.navigationController.navigationBarHidden = NO; //7.//navigationBar:设置navigationBar.<span style="color:#FF0000;">translucent</span>(透明度)的值为NO,其默认值是YES;设置navigationBar的值为NO后,视图的(0,0)点就是在navigationBar的左下角. self.navigationController.navigationBar.translucent = NO;
二.跳转页面的方法
1.从前往后跳转页面
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated; // Uses a horizontal slide transition. Has no effect if the view controller is already in the stack. 例如:
[self.navigationController pushViewController:_registVC animated:YES];
2.从后往前跳转页面
//这个方法是返回前一个界面
- (UIViewController *)popViewControllerAnimated:(BOOL)animated;
// Returns the popped controller.
//这个方法是返回到在同一条链路上的任意一个界面
- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated;
// Pops view controllers until the one specified is on top. Returns the popped controllers.
//这个方法是返回到根视图
- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated;
// Pops until there's only a single view controller left on the stack. Returns the popped controllers.
相关文章推荐
- UESTCoj 265 War(Floyd最短路)
- UESTC 360 Another LCIS(线段树 x 经典区间合并姿势)
- 58.UITableView:改变 TableHeaderView 的高度--跟随cell滚动
- IOS-笔记20(Embed Segues)
- UISlider控件基本用法
- 对TimeQuest一些术语的解释
- UE3 Creating A Mesh Proxy
- Error之ViewPage :Required method instantiateItem was not overridde
- 36.在iPhone4S上,UIButton-setEnabled属性为NO时,无法改变button的状态,如上面的文字
- IOS8如何获取当前UIViewController
- 28.iOS - UIButton(UIEdgeInsets)/设置button上的文字和图片 在定义位置
- source /build/envsetup.sh和lunch)
- 19.UIDatePicker日期选择器
- iOS开发之指定UIView的某几个角为圆角
- UIActivityViewController 自定义选项
- Echarts异步模块定义(AMD规范)——require.js
- UIImage加载图片方式一般有两种
- UITextField中加入清除按钮
- 9..IOS学习:用UIWindow自定义AlertView(最基本代码)
- HDU 2227 Find the nondecreasing subsequences(DP)