Reputation: 27113
I create project with supported interface orientation landscape only.
In IB I change orientation my view on landscape and change size to w: 480 h:320.
In method -scrollViewDidScroll I get width of my view (self.view.frame.size.width) and the value is 320 but in IB i set up it in 480.
Anybody know what is it? Thanks!
Upvotes: 0
Views: 115
Reputation: 40995
Changing orientation in IB doesn't make any difference to the view once it's loaded - it's just for your convenience when laying out your controls.
The view's actual width will depend on the orientation of the device at runtime, assuming you've allowed it to rotate.
When the view is loaded from the nib it will be resized to fit the screen automatically, so if your phone is in portrait mode when you load it, the width will be 320.
Make sure you've set up the willRotateToInterfaceOrientation:
method correctly in your view controller.
If that's all correct and it's displaying in landscape, another thing to try is to use the self.view.bounds.size.width
property instead, as the inner size (bounds) is not always the same as the outer size (frame) if the view has been rotated.
Upvotes: 2