UIWebView on iPad size

后端 未结 2 1273
天涯浪人
天涯浪人 2020-12-10 09:44

I am using the UIWebView on iPad, which I initialize by the code below. The problem is that the view is never displayed on the top of the page just under the Status bar, but

相关标签:
2条回答
  • 2020-12-10 10:14

    The problem is that the coordinate system of the view you're adding it to isn't the coordinate system of the window; the view has already been adjusted for the status bar.

    Change it thus:

    CGRect rectApp = [[UIScreen mainScreen] applicationFrame];
    rectApp.origin = CGPointZero;
    

    Or better yet, use self.view.bounds, since self.view presumably refers to a view that fills the application's window anyway.

    0 讨论(0)
  • 2020-12-10 10:23

    I like Tony's answer. When I ran into this problem I used the generic view.frame = self.view.bounds, in your code this would be written:

    self.webView.frame = self.view.bounds;
    
    0 讨论(0)
提交回复
热议问题