iOS7 Webview initial scroll position under Navigation bar

后端 未结 8 2609
[愿得一人]
[愿得一人] 2021-02-18 22:50

I have a webview which is scrolling as desired underneath a navigation bar.

However, when I first load the controller, the page loaded in the webview is scrolled so that

8条回答
  •  礼貌的吻别
    2021-02-18 23:22

    use the below

    CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame];
    CGFloat navHeight = self.navigationController.navigationBar.frame.size.height;
    applicationFrame.origin.y = navHeight + 4;
    webView = [[UIWebView alloc] initWithFrame:applicationFrame];
    

提交回复
热议问题