我想在 subview 中使用 presentModalViewController
方法,但它对我不起作用
这是我的代码:
subview :
-(IBAction) PressMoyensEs {
MoyensEstimatifsViewController *MoyE = [[MoyensEstimatifsViewController alloc] initWithNibName:@"MoyensEstimatifsViewController" bundle:nil];
[self.parentViewController presentModalViewController:MoyE animated:YES];
}
最佳答案
你检查过你的self.parentViewController
了吗?它很可能是 nil
,在许多情况下都是如此,因此您的代码会悄无声息地失败。
而且,您是否尝试过 [self presentModalViewController:MoyE animated:YES];
?它不太“正确”,但如果有效,则已经排除了一些失败原因。
关于iphone - 从 subview 使用 presentModalViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7121263/