2012年3月28日 星期三

控制storyboard , reload storyboard , segue

好用參考來源
http://ryan.easymorse.com/?p=39

---------------------------

要使每次載入都回到login
可在applicationWillEnterForeground加上



    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    
    self.window.rootViewController = [storyboard instantiateInitialViewController];
    
    [self.window makeKeyAndVisible];

這樣可以reload整個storyboard,等於跟剛開啟一樣

-------------------

還有控制segue
    
    [self performSegueWithIdentifier:@"push to photolibrary" sender:nil];

詳細猜考來源

--------------------

直接載入特定storyboard

    UIStoryboard *storybord = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    [self presentViewController:[storybord instantiateViewControllerWithIdentifier:@"PhotoLibrary"] animated:NO completion:nil];





沒有留言: