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.
精彩评论