storyboard 小结

一.类介绍
UIStoryboard
得到一个StoryBoard
+ (UIStoryboard *)storyboardWithName:(NSString *)name bundle:(NSBundle *)storyboardBundleOrNil
// 也可以通过一个在storyboard中有sence的viewController中用self.storyBoard得到自己所在的storyboard
接口
- (id)instantiateInitialViewController
// 返回第一个界面,每个storyboard都必须有一个入口界面,特别是程序的主storyboard的第一个界面,就是程序的主界面。
- (id)instantiateViewControllerWithIdentifier:(NSString *)identifier
// storyboard中相应标识对应的界面。如果identifier不存在或者为nil,引发异常。

UIStoryboardPopoverSegue
@property(nonatomic, retain, readonly) UIPopoverController *popoverController

UIStoryboardSegue
两个界面之间的转换,转换之前调用当前view controller的 prepareForSegue:sender: 函数(这里可以处理一些数据赋值之类).可以通过生成子类来自定义转换动画.
初始化
- (id)initWithIdentifier:(NSString *)identifier source:(UIViewController *)source destination:(UIViewController *)destination
属性
@property(nonatomic, readonly) id destinationViewController
@property (nonatomic, readonly) NSString *identifier
@property(nonatomic, readonly) id sourceViewController
动画
- (void)perform // 子类重写来自定义转换动画

二,使用
1.根据上面的UIStoryBoard类知道,可以简单的把storyboard当成以前的nib文件使用,只不过他是一个合集,读取文件用另一种自己的函数就行了.
2.正常的使用当然是灵活运用UIStoryboardSegue.它可以关系两个controller,关系一个controller中的控件到另一个controller中.还可以自定义一些动画.

详细的介绍可阅:
http://www.raywenderlich.com/5138/beginning-storyboards-in-ios-5-part-1
http://www.raywenderlich.com/5191/beginning-storyboards-in-ios-5-part-2
btw:官方例子TVAnimationsGestures中
if(!cell)
{
}
这段代码完全不会执行,dequeueReusableCellWithIdentifier就可以找到cell了。

原文地址:https://www.cnblogs.com/v2m_/p/2272221.html