I have a subclass of UIViewController and the height is always 460 (self.view.frame.size.height). I don't have the status bar in place, and so I want it to be 480?? Is there a way so that it can return 480?
Asked
Active
Viewed 5,408 times
3
-
Not enough details... For example, have you set the `autoresizingMask` of your view? – DarkDust Jan 23 '12 at 06:35
-
well I have a UIScrollView and I want that to be set to the full view's/full screen size of whatever screen size it is.. however when I do self.frame.size.height it is always 460.. so there is some gap at the bottom – xonegirlz Jan 23 '12 at 06:41
4 Answers
4
You could do it like this:
- (void)viewDidLoad
{
// View setup
// Ensure the view will keep filling its parent
// when the parent view resizes (e.g. device rotation).
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
}
- (void)viewWillAppear:(BOOL)animated
{
// Force to fill the parent once the view is about to be shown.
self.view.frame = self.view.superview.bounds;
}
If you would use a XIB you'd set the autoresizing mask in Interface Builder instead.

DarkDust
- 90,870
- 19
- 190
- 224
3
You can set like this
self.view.frame=CGRectMake(0, 0,320, 480);
inside viewdidLoad or loadView

Mudit Bajpai
- 3,010
- 19
- 34
-
there are only two ways one way is you can use xib and change the status bar property to None and set the height of the view according to your requirement and second way is you can set the height through your code.It's your's choice what option you want to choose. – Mudit Bajpai Jan 23 '12 at 07:08
-
xonegirlz' point was that she doesn't want to hard-code the numbers (320, 480). And she doesn't need to: simply assign the value of `self.view.superview.bounds` instead. – DarkDust Jan 23 '12 at 10:04
-
@DarkDust:I have already given the other option also in comment.Read carefully... – Mudit Bajpai Jan 23 '12 at 10:07
1
Go to your interface builder -> attributes Inspector -> simulated metrics -> status Bar -> none. And after that you can change the height of your view.
Please check the below link: how to hide status bar in Iphone application
It may help you..
0
If you are using a xib hide the status bar using property,else you can do
[application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
in applicationDidFinishLoading method of your AppDelegate.THe other approach is using info.plist.

Abhinandan Sahgal
- 1,076
- 1
- 13
- 27
-
I can't seem to do setStatusBarHidden, I don't think there's such thing – xonegirlz Jan 23 '12 at 06:38