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.bounds
return null)...
views:
23answers:
1
A:
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.
NR4TR
2010-09-25 21:46:09
…and the screen's size is 320 × 480 and the window occupies the whole screen. The latter will probably remain true in the foreseeable future, but the former is already untrue on some of the devices on the iOS platform.
Peter Hosey
2010-09-26 21:47:13
`[[UIScreen mainScreen] bounds]`
NR4TR
2010-09-27 07:07:07