Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
669 views
in Technique[技术] by (71.8m points)

objective c - Height of UIWebView minus 44px programmatically?

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

[webView.height: currentHeight - 44px];

So essentially, I want to get the height of the UIWebView and then make it 44px shorter from the bottom, programmatically.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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 :-)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...