UIStoryboard学习

  • UIStoryboard object encapsulates the view controller graph stored in an Interface Builder storyboard resource file. This view controller graph represents the view controllers for all or part of your application’s user interface. Normally, view controllers in a storyboard are instantiated and created automatically in response to actions defined within the storyboard itself. However, you can use a storyboard object to instantiate the initial view controller in a storyboard file or instantiate other view controllers that you want to present programmatically.

     

    简明:

    一个 UIStoryboard对象囊括了,保存在IB分镜资源文件(xxx.storyboard)中的视图控制器图表。这个视图控制器图表代表你应用程序界面中所有或部分视图控制器(也可手动创建视图控制器)。

     

    方法:

    1. + (UIStoryboard *)storyboardWithName:(NSString *)name  bundle:(NSBundle *)storyboardBundleOrNil

    Creates and returns a storyboard object for the specified storyboard resource file.

    通过指定的storyboard resource创建并返回一个storyboard对象。


    Parameters

    name

    The name of the storyboard resource file without the filename extension. This method raises an exception if this parameter is nil.

    storyboardBundleOrNil

    The bundle containing the storyboard file and its related resources. If you specify nil, this method looks in the main bundle of the current application.

     

    1. - (id)instantiateInitialViewController

    Instantiates and returns the initial view controller in the view controller graph.

    在视图控制器图表中(storyboard对象),实例化并返回标记为initial的视图控制器

     

     

    1. - (id)instantiateViewControllerWithIdentifier:(NSString *)identifier

    Instantiates and returns the view controller with the specified identifier.

    实例化并返回特定ID的视图控制器。

     

    此处的identifier指的是视图控制器ID监视器中的stroryboard ID,若方法中该值为nil或实际上找不到,程序会报出异常。

     

    源文档 <https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIStoryboard_Class/index.html#//apple_ref/occ/clm/UIStoryboard/storyboardWithName:bundle:>  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值