initWithRootViewController、initWithStyle、initWithNibName

initWithRootViewController、initWithStyle、initWithNibName

1、UINavigationController通过栈来实现。添加一个Controller为入栈,释放一个Controller为出栈。复习下栈:

1)栈是先进后出

2)栈顶是最后一个入栈的对象

3)基栈是是第一个入栈的对象(栈底)

UINavigationController经常使用的函数:

(1)- (id)initWithRootViewController:(UIViewController *)rootViewController

添加根视图控制器,最先显示。

(2)- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;

(3)- (UIViewController *)popViewControllerAnimated:(BOOL)animated;

Controller出栈操作

这里要注意:每次push Controller后,Controller系统返回按钮实现pop这个Controller。

2、initWithStyle是UITableViewController提供的初始化函数,可以初始化为plain或grouped类型,当前VC为UITableViewController或其子类时使用

1)UITableView继承自UIScrollView,可以表现为Plain和Grouped两种风格

2)UITableView继承自UIScrollView

3)UITableView有两个Delegate:dataSource和delegate

3)UITableViewController是系统提供用来管理UITableView的类,自身包含了TableView的UITableViewDataSourceDelegate和UITableViewDelegate


3、initWithNibName是使用Xib文件的数据初始化控制器,参数应该是某一个xib文件对应的实体类

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值