开发者

Getting the frame / bounds of a view

Another newbie question: If I have a UIViewController with a navigation bar visible at the top and a visible toolbar at the bottom, how do I ask the view controller for the coordinates (frame, bounds) of the "visible" area of the view? (self.view.frame and self.view.bou开发者_如何学Cnds return null)...


If I understand you in the right way, you could calculate the frame size yourself.

#define kNavigationBarHeight 44
#define kToolbarHeight 44
#define kSystemBarHeight 20
#define kWindowWidth 320
#define kWindowHeight 480

int width = kWindowWidth;
int heigth = kWindowHeight - kNavigationBarHeight - kToolbarHeight - kSystemBarHeight;
CGSize myViewSize = CGSizeMake(width, height);

That will be true if your navbar and toolbar are of standard sizes and your layout orientation is portait.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜