我想在有人成功登录时更改屏幕。我知道如何访问我的控制器类而不是特定的屏幕。
[NRGramKit loginInWebView:self.webView loginLoadingCallback:^(BOOL loading){
NSLog(@"Loading");
} finishedCallback:^(IGUser* user,NSString* error){
// yay - you are now authenticated, NRGramKit remembers the credentials
LoggedInViewController *loggedInViewController = [[LoggedInViewController alloc]init];
loggedInViewController.myUser = user;
[self presentViewController:loggedInViewController animated:YES completion:nil];
}];
答案 0 :(得分:0)
您可以在instantiateViewControllerWithIdentifier:
的实例上使用UIStoryboard
方法以编程方式从故事板中实例化视图控制器。
UIStoryboard *myStoryboard = [UIStoryboard storyboardWithName:@"MyStoryboard" bundle:nil];
MyViewController *vc = [myStoryboard instantiateViewControllerWithIdentifier:@"Page"];
// use view controller and its view as required
如果您的视图控制器来自故事板,那么storyboard
属性将返回它来自的故事板。所以你可以跳过故事板初始化。
// within a view controller
OtherViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"OtherIdentifier"];