Height of UIWebView minus 44px programmatically?

前端 未结 2 1703
滥情空心
滥情空心 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: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 :-)

提交回复
热议问题