iOS: display modal view over the top of a UIWebView

只愿长相守 提交于 2019-12-04 13:45:50

I ran into this same problem. Moving the presentModalViewController call from viewDidLoad to viewDidAppear did the trick.

I couldn't get it to work in viewDidLoad either, but I got it to work in a different method. Here's what I did:

- (void)viewDidLoad {
    ...

    if (some_condition) {
        [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(showModal) userInfo:nil repeats:NO];
    } 
}

- (void)showModal {
    LandscapeCoverController *landscapeCoverController = [[[LandscapeCoverController alloc] init] autorelease ];
    [self presentModalViewController:landscapeCoverController animated:YES];    
}

Basically, it works if it's not being called in viewDidLoad. I wish I could explain why, I'm curious myself, but this should at least fix your problem.

Hope this helps!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!