老生常談 storybord的使用小貼士

(一)通過segue的identify來尋找對應控制器:

<span style="font-size:18px;">-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    if([[segue identifier] isEqualToString:@"ContactsViewControllerSegue"]){
         ContactsViewController *cvc = (ContactsViewController *)[segue destinationViewController];
         cvc.contacts = self.contacts;
         cvc.delegate = self;
     }
}</span>

(二)通過identify來尋找storyboard中的控制器

UIStoryboard is a runtime representation of everything configured inside Interface Builder as such any individual scene can be loaded using either,

[UIStoryboard instantiateInitalViewController]
[UIStoryboard InstantiateViewControllerWithIdentifier]


(三)對於多個storyboard,如何尋找特定的storyboard

Should you choose to split your application across multiple Storyboards these can be loaded using,

[UIStoryboard storyboardWithName:bundle:]


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章