##DAY14——StoryBoard

•iOS下可視化編程分爲兩種⽅式:xib和storyboard。編程

•在使用xib和storyboard建立GUI過程當中,以XML文件格式 存儲在Xcode中,編譯時生成nib的二進制文件。在運行時, nib⽂件被加載而且開始建立和實例化GUI元素。ide

//當stroyboard經過頁面跳轉時,此方法就會執行
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    //segue有三個很是重要的屬性
    /*
     一、identifier,標識符,標識區份線(segue),能夠選擇性的跳轉
     二、sourceViewController,源視圖控制器
     三、destinationViewController,目標視圖控制器
     */
    if([segue.identifier isEqualToString:@"secondVC"]){
        SecondViewController *secondVC = segue.destinationViewController;
        secondVC.string = self.usernameTF.text;
        
    }
}

 

- (IBAction)regist:(id)sender {
    //每個視圖控制器都有一個屬性叫storyboard,能夠找到當前視圖控制器交由哪一個故事板管理。而且故事板能夠經過storyboardID來找到加到其內部的視圖控制器
//    UIViewController *controller =
//    [self.storyboard instantiateViewControllerWithIdentifier:@"second"];

//    [self presentViewController:controller animated:YES completion:nil];
    
    [self performSegueWithIdentifier:@"secondVC" sender:nil];
}
相關文章
相關標籤/搜索