开发者

Use presentModalViewController from a subView

I wanna use the presentModalViewController method from a subview, but it's not 开发者_JAVA百科working for me here is my code:

The subview:

-(IBAction) PressMoyensEs {
    MoyensEstimatifsViewController *MoyE = [[MoyensEstimatifsViewController alloc] initWithNibName:@"MoyensEstimatifsViewController" bundle:nil];
    [self.parentViewController presentModalViewController:MoyE animated:YES];
}


Have you checked your self.parentViewController? It's likely to be nil, as it is in many case, and thus your code is failing silently.

And, have you tried just [self presentModalViewController:MoyE animated:YES];? It's less 'correct', but if working, would already exclude some causes of failure.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜