Height of UIWebView minus 44px programmatically?

前端 未结 2 1693
滥情空心
滥情空心 2020-12-18 16:19

Is it possible to set the height of a UIWebView by doing something like this..

[webView.height: currentHeight - 44px];

So essentially, I wa

相关标签:
2条回答
  • 2020-12-18 17:04

    I guess this should be enough.

    webView.frame = CGRectMake(webView.frame.origin.x, webView.frame.origin.y, webView.frame.size.width, webView.frame.size.height - 44);
    
    0 讨论(0)
  • 2020-12-18 17:09

    Save your old frame like this:

    CGRect oldFrame = WebView.frame;
    

    Then set the new frame :

    CGRect newFrame =CGRectMake(oldFrame.origin.x, oldFrame.origin.y, oldFrame.size.width, oldFrame.size.height-44);
    [WebView setFrame:newFrame];
    

    Thats it :-)

    0 讨论(0)
提交回复
热议问题