Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 521
xonegirlz Avatar asked Nov 27 '25 19:11

xonegirlz


2 Answers

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.

like image 101
DarkDust Avatar answered Nov 29 '25 09:11

DarkDust


You can set like this

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

inside viewdidLoad or loadView

like image 23
Mudit Bajpai Avatar answered Nov 29 '25 07:11

Mudit Bajpai



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!