Adn*_*nan 0 objective-c ios presentviewcontroller
我有三个View Controller VC1,VC2和VC3.
VC2是第三方库,它在VC1上呈现.
然后VC2解散自己并向VC1发送回调,VC1尝试向自己呈现VC3但失败了.
解雇VC2后有没有办法立即呈现VC3?
-(void)onDismisLoginVC{
MessageVC *messageVC = [[MessageVC alloc] initWithNibName:@"MessageVC" bundle:nil];
[self.navigationController presentViewController:messageVC animated:YES completion:NULL];
}
Run Code Online (Sandbox Code Playgroud)
不幸的是我无法^completion在VC2中使用解除显示的viewcontroller的块,因为我只是接收到这个方法的回调而无法编辑VC2的代码.
我知道我们总是把它nil用于完成块......但实际上确实有一些用处.我向你保证.
[self dismissViewControllerAnimated:YES completion:^{
//code to be executed with the dismissal is completed
// for example, presenting a vc or performing a segue
}];
Run Code Online (Sandbox Code Playgroud)
小智 5
这是我用来解雇Facebook登录视图控制器的那个.
UIViewController *theTrick = self.presentingViewController;
UIViewController *toPresent = [self.storyboard instantiateViewControllerWithIdentifier:@"toPresentViewController"];
[self dismissViewControllerAnimated:YES completion:^{
[theTrick presentViewController:toPresent animated:YES completion:nil];
}];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13628 次 |
| 最近记录: |