UIWebView on iPad size

后端 未结 2 1281
天涯浪人
天涯浪人 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.

提交回复
热议问题