Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrong frame value while accessing the view from storyboard in IOS

I am accessing the size of the frame of view from storyboard. Below is my code for accessing frame property from storyboard.

SmallView *smallView = [self.storyboard instantiateViewControllerWithIdentifier:@"SmallView"];
CGRect frame = smallView.view.frame;
self.containerView.frame = frame;

In story board the frame size of the view is (200,400). But when I am accessing the frame size from the code it's always giving (320,460).Why? In the above code I got small view object from storyboard so what will be the value of view's frame in story board that should be shown but it's not showing.Always it's showing (320,460).

For quick debugging you can check the below source code .

https://dl.dropbox.com/u/90940570/FrameTest.zip

like image 438
NSCry Avatar asked Jan 25 '13 11:01

NSCry


Video Answer


1 Answers

Uncheck the "Resize View From Nib" box in the inspector. That should give you the correct size for a freeform view controller.

like image 84
rdelmar Avatar answered Sep 17 '22 18:09

rdelmar