views:

23

answers:

1

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

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
…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
`[[UIScreen mainScreen] bounds]`
NR4TR