How to retrieve available height considering other UIElement's height?
How can i get the available height?
I tried:
NSLog(@"%f", [self bounds].size.height);
NSLog(@"%f", [self frame].size.height);
NSLog(@"%f", [[UIScreen mainScreen] bounds].size.height);
I get always the screen's height. But the actual height is smaller. With Informationbar on the top + Nav-Ba开发者_StackOverflow社区r, the height is smaller.
EDIT: I need to retrieve the height programmatically. Thats if there is a TabBar and my View is not always in a NavBar-Controller. Maybe there is no NavBar.
Navigation bar has a predefined height of 44 which you can never change. And by information bar, i think u mean the status bar which has a fixed height of 20. Total height of iPhone screen is 480. U do the calculations... :)
However, if you want the height of such a screen then in the nib always have status bar and navigation bar simulated and then have all the UI elements for that. After that, when you'll do
self.view.frame.size.height
you'll get the height of your view
self.view.frame.size.height;
OR
float theHeight = // one of the methods you posted
theHeight -= 44; // for nav bar
theHeight -= 20; // for status bar
精彩评论