UINavigationController
来源:互联网 发布:2017网络与新媒体大学 编辑:程序博客网 时间:2024/06/05 21:52
UINavigationController的使用步骤
初始化UINavigationController
设置UIWindow的rootViewController为UINavigationController
根据具体情况,通过push方法添加对应个数的子控制器。
UINavigationController以栈的形式保存子控制器
@property(nonatomic,copy) NSArray *viewControllers;
@property(nonatomic,readonly) NSArray *childViewControllers;
使用push方法能将某个控制器压入栈
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;
使用pop方法可以移除控制器
将栈顶的控制器移除
- (UIViewController *)popViewControllerAnimated:(BOOL)animated;
回到指定的子控制器
- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated;
回到根控制器(栈底控制器)
- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated;
1.导航栏的View显示的内容是栈顶控制器的View.
2.导航栏的内容由栈顶控制器的navigationItem属性决定.
UINavigationItem有以下属性影响着导航栏的内容
左上角的返回按钮
@property(nonatomic,retain) UIBarButtonItem *backBarButtonItem;
中间的标题视图
@property(nonatomic,retain) UIView *titleView;
中间的标题文字
@property(nonatomic,copy) NSString *title;
左上角的视图
@property(nonatomic,retain) UIBarButtonItem *leftBarButtonItem;
UIBarButtonItem *rightBarButtonItem 右上角的视图
@property(nonatomic,retain) UIBarButtonItem *rightBarButtonItem;
// 修改下一个界面返回按钮的文字
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStyleDone target:nil action:nil];
- UINavigationController
- UINavigationController
- UINavigationController
- UINavigationController
- UINavigationController
- UINavigationController
- UINavigationController
- UINavigationController
- UINavigationController
- UINavigationController
- UINavigationController
- UINavigationController
- UINavigationController
- UINavigationController
- UINavigationController
- UINavigationController
- UINavigationController
- UINavigationController
- Java HTTP连接将网络图片下载到本地
- poj-1064
- Spring XML 配置里的bean 的自定装配
- WinForm控制Webbrowser自动登录
- xcode编译经常出现的问题
- UINavigationController
- AFNetworking 2.x 设置header
- Hadoop-2.5.1集群安装配置笔记 .
- 找回SQL Server数据库SA密码
- 第七周上机-项目 员工周工资
- Centos6.5 下ceph 0.80.7源码安装配置
- 判断第一次加载
- javascript学习-原生javascript的小特效(原生javascript实现链式运动)
- jquery插件SuperSlide使用说明