views:

16

answers:

2

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: 
  1. Are you using a seperate view or the the view that is given by the view controller?.....

  2. Do you want to set the size of the view according to the tab bar?....

deamonsarea
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
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
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