Reputation: 8101
I'm working on modifying this app, and it has a view that fills the screen. Unfortunately, this is all set statically in the interface builder.
Is there a button somewhere on XCode (I'm new to XCode) that will tell it to automatically fill the device screen?
If not, how can I change the height programmatically?
Thanks!
Upvotes: 0
Views: 5158
Reputation: 5113
Set your controller's frame as you want it to be in Interface Builder. For example, if you're working on iPad simulator and want the view to be full screen, set x and y to 0 and set the width and height to 768 and 1024 on portrait or 1024 and 768 if you have selected landscape. I also suggest working with springs and struts which is easier to start with. For that you need to select your controller, and go to File Inspector
tab on right and uncheck Use AutoLayout
No go to springs and struts
tab, and make sure that you have set it to expand in both width and height while maintaining its distance from left, top, right, and bottom.
That would make your view resize itself depending on the device size.
Upvotes: 1
Reputation: 2575
I think what you are looking for is
CGRect screenBounds = [[UIScreen mainScreen] bounds];
Then you can set the view accordingly like so:
self.view.frame = screenBounds;
Upvotes: 0