iOS Container View Controller小小的研究

一、介绍

老规矩先看SDK

Container view controllers are a critical part of iOS app design. They allow you todecompose your app into smaller and simpler parts, each controlled by a viewcontroller dedicated to that task. Containers allow these view controllers towork together to present a seamless interface.

就是说,容器型的viewController能够把app分为很多小而简单的部分来管理,允许他们一起无缝的展示用户界面。


其实应该已经接触过了一些container,viewcontrollers 经常很container一起工作。例如NavigationController、TabBar就是几个典型的container,它可以管理很多view controller。这次就来小小的研究一下customer container。


二、API

addChildViewController:

removeFromParentViewController

transitionFromViewController:toViewController:duration:options:animations:completion:

willMoveToParentViewController:

didMoveToParentViewController:

基本上就是这几个方法。


三、用法

  • 添加子节点

//定义child
First *first = [[Firstalloc]initWithNibName:@"First"bundle:nil];
//添加child
[selfaddChildViewController:first];

  • 获得子节点

[self.childViewControllersobjectAtIndex:0];

添加进入的子节点是有顺序的,从0开始。

  • 获取子节点的个数

self.childViewControllers.count
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值