Cod*_*elp 2 objective-c uiviewcontroller ios
我在做一些测试时遇到了这个问题.我提出了一个名为ModalView1的模态视图.在ModalView1中,当按下一个按钮时,将使用另一个Modal视图,称为ModalView2 presentViewController.然后我尝试解雇ModalView2 dismissViewControllerAnimated但它无法正常工作.
这是按钮操作中的代码片段
- (void) buttonAction: (UIButton*) sender
{
ModalView *ModalView2 = [[ModalView alloc] init];
[self presentViewController:ModalView2 animated:YES completion:nil];
[self dismissViewControllerAnimated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将非常感激.谢谢.
目前尚不清楚你要做什么.我给你两个选择:
呈现ModalView2然后解雇ModalView2(对我没有意义,但这是我在你的问题中可以阅读的内容)
- (void) buttonAction: (UIButton*) sender {
ModalView* modalView2 = [[ModalView alloc] init];
[self presentViewController:modalView2 animated:YES completion:^{
[modalView2 dismissViewControllerAnimated:YES completion:nil];
}];
}
Run Code Online (Sandbox Code Playgroud)
演示ModalView2并解除ModalView1:
- (void) buttonAction: (UIButton*) sender {
ModalView* modalView2 = [[ModalView alloc] init];
UIViewController* presentingViewController = self.presentingViewController;
[self dismissViewControllerAnimated:YES completion:^{
[presentingViewController presentViewController:modalView2 animated:YES completion:nil];
}];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15871 次 |
| 最近记录: |