xonegirlz
xonegirlz

Reputation: 8977

height of UIViewController is set to 460

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?

Upvotes: 3

Views: 5419

Answers (4)

DarkDust
DarkDust

Reputation: 92384

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.

Upvotes: 4

Mudit Bajpai
Mudit Bajpai

Reputation: 3020

You can set like this

self.view.frame=CGRectMake(0, 0,320, 480);

inside viewdidLoad or loadView

Upvotes: 3

Sharme
Sharme

Reputation: 637

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

Upvotes: 1

Abhinandan Sahgal
Abhinandan Sahgal

Reputation: 1076

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.

Upvotes: 0

Related Questions