开发者

Get bounds of visible area of UIView for iPhone

I have a UIView and I want to get its VISIBLE bounds. For example sometimes there's a tabbar; sometimes there's not. I would like to get different values for these two cases. UIView.bounds always just returns th开发者_运维问答e bounds of the entire screen of the phone (available to apps) which is not what I want.


I'm not totally clear about your scenario. If you know the scenarios, you can set your view size and position. The height of the navigation bar is 44 pixels. Then you can define the frame of your view according to your need like this,

If you are getting the navigation bar on top without a tab bar below,

CGRect newFrame = yourView.frame;
newFrame.origin.y = 44.0;
newFrame.size.height = 436.0;
newFrame.size.width = 320.0;
yourView.frame = newFrame;

If you are getting the navigation bar on top with the tab bar below,

CGRect newFrame = yourView.frame;
newFrame.origin.y = 44.0;
newFrame.size.height = 387.0;
newFrame.size.width = 320.0;
yourView.frame = newFrame;

Hope this will help.....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜