UIStoryboard UIStoryboardSegue

--------------------------------------------------------------------------------UIStoryboardSegue--------------------------------------------------------------------------------

1: 使用UIStoryboardSegue跳转时触发 此方法优先与下一个ViewController 的 viewDidLoad 方法

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

2: 在UIStoryboardSegue中存放原始的ViewController 和 目的地的ViewController 的引用, 转换类型后,可以直接对其操作

[(UIViewController *)segue.sourceViewController setTitle:@"嘿"];//原始
[(DrawViewController *)segue.destinationViewController setDrawTypeString:segue.identifier];//目的地

--------------------------------------------------------------------------------UIStoryboardSegue--------------------------------------------------------------------------------

--------------------------------------------------------------------------------UIStoryboard--------------------------------------------------------------------------------

1: 根据 Identifier 获取 指定 Identifier 的实例 

AboutViewController *about = [storyboard instantiateViewControllerWithIdentifier:ABOUT_IDENTIFIER];


注:调用时如果没有找到,App 将直接Crash

2: 获取StoryBoard 默认的第一个实例

[storyboard instantiateInitialViewController];

3:在AppDelegate 中手动初始化 某个StoryBoard

self.window = [[iConsoleWindow alloc] init];
self.window.rootViewController = [[UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil] instantiateInitialViewController];

4:从普通XIB中跳转到StoryBoard 

UIStoryboard *stryBoard=[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
self.view.window.rootViewController=[stryBoard instantiateInitialViewController];





XCode 对 StoryBoard 监听到的警告解析


--------------------------------------------------------------------------------UIStoryboard--------------------------------------------------------------------------------


你可能感兴趣的:(UIStoryboard UIStoryboardSegue)