iOS学习之——UIStoryboard

来源:互联网 发布:彩超 矩阵探头 编辑:程序博客网 时间:2024/06/06 00:28

1、UIStoryboard类
此类继承于NSObject,共有三个方法,一个类方法,两个实例方法
1)得到一个StoryBoard Object对象:类方法

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

// 也可以通过一个在storyboard中有scene的viewController中用self.storyBoard得到自己所在的storyboard对象。
2)接口

- (id)instantiateInitialViewController;

// 返回第一个界面(根视图所在界面),每个storyboard都必须有一个入口界面,特别是程序的主storyboard的第一个界面,就是程序的主界面。

- (id)instantiateViewControllerWithIdentifier:(NSString *)identifier;

// storyboard中相应标识对应的界面。如果identifier不存在或者为nil,引发异常。
2、UIStoryboardSegue类,同样此类继承于NSObject
两个界面之间的转换,转换之前调用当前view controller的 prepareForSegue:sender: 函数(这里可以处理一些数据赋值之类).可以通过生成子类来自定义转换动画.

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{}

1)属性

@property(nonatomic, readonly) id destinationViewController  // (read-only)@property (nonatomic, readonly) NSString *identifier    // (read-only)@property(nonatomic, readonly) id sourceViewController   // (read-only)

2)初始化,此类公有一个实例方法

- (id)initWithIdentifier:(NSString *)identifier source:(UIViewController*)source destination:(UIViewController *)destination;

3、UIStoryboardPopoverSegue类。此类继承于UIStoryboardSegue : NSObject
此类只有一个属性:

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

4、动画
- (void)perform; // 子类重写来自定义转换动画

@property(nonatomic, retain, readonly) UIPopoverController*popoverController;
1 0
原创粉丝点击