I have a UIView and I want to get its VISIBLE bounds. For example sometimes there's a tabbar; sometimes there's not. I would like to get different values for these two cases. UIView.bounds always just returns the bounds of the entire screen of the phone (available to apps) which is not what I want.
A:
Are you using a seperate view or the the view that is given by the view controller?.....
Do you want to set the size of the view according to the tab bar?....
deamonsarea
2010-10-27 10:37:33
I am using a separate view. The tabbar was just an example. There is sometimes a navigation panel as well. I just want to know the dimension of the view not covered by other elements.
jcmoney
2010-10-27 18:09:43
A:
I'm not totally clear about your scenario. If you know the scenarios, you can set your view size and position. The height of the navigation bar is 44 pixels. Then you can define the frame of your view according to your need like this,
If you are getting the navigation bar on top without a tab bar below,
CGRect newFrame = yourView.frame;
newFrame.origin.y = 44.0;
newFrame.size.height = 436.0;
newFrame.size.width = 320.0;
yourView.frame = newFrame;
If you are getting the navigation bar on top with the tab bar below,
CGRect newFrame = yourView.frame;
newFrame.origin.y = 44.0;
newFrame.size.height = 387.0;
newFrame.size.width = 320.0;
yourView.frame = newFrame;
Hope this will help.....
deamonsarea
2010-10-28 10:22:48
The point is I don't always know that there will or will not be a navigationbar or tabbar. I just know it MIGHT be there and would like to get the bounds of the remainder of the screen. I would prefer to avoid hardcoding values anyways.
jcmoney
2010-10-29 04:36:33