Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatical equivalent to UIViewController's "Resize View From NIB" property

What is the programmatical equivalent to UIViewController's Resize View From NIB when editing a storyboard in Xcode's Interface Builder?

I want to set this to no for a view controller that uses a xib file instead of a storyboard.

Resize View From NIB

like image 444
Ricardo Sanchez-Saez Avatar asked Oct 03 '14 12:10

Ricardo Sanchez-Saez


1 Answers

There is no method in UIViewController that is meant to be mapped to that IB property. However, since it affects the size and position of the top-level view in relation to the status bar, the programmatic equivalent would probably be the following, if the status bar is visible:

int statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
CGRect viewFrame = self.view.frame;
self.view.frame = CGRectMake(0, statusBarHeight, viewFrame.size.width, viewFrame.size.height - statusBarHeight);
like image 193
Sheamus Avatar answered Oct 20 '22 22:10

Sheamus