Reputation:
I have an UIScrollView
, where i show various settings for my application.
I created the UIScrollView
from the builder , i added it as a sub view to my View and from the size inspector of the builder i placed it in position Y: -10 , to show just under my navigation bar. In my code i just added
self.scrollView.contentSize =CGSizeMake(self.scrollView.frame.size.width,1000);
and everything works as expected.
My problem starts , when i try to rotate the screen. Two major problems arise.
The first one is that , the start of the UIScrollView is not the same. It "starts" from a lower place than it should , hiding some options. (image below)
The second one is that , the width of the UIScrollView is not automatically adjusted to the new screen orientation and is the same as before. (image below)
So what exactly should i do , to have a nice result on both orientations?
I attach images with both orientations. The first one is the portrait which "works" as expected , the second one is the landscape where the problems arise.
Upvotes: 0
Views: 2770
Reputation: 1014
Adjust your scrollView
s frame
in -viewDidLayoutSubviews
(called when device rotates) or use Springs and Struts
Upvotes: 1