I'm using an NIPagingScrollView
to display several pages on the iPhone.
Everytime I flick to a page, the next page is also pre-loaded, which is fine.
When I rotate the iPhone from Portrait to Landscape mode, I let layoutSubviews
do the re-layouting in my subclass of NIPageView
. The NIPagingScrollView
is set to auto-stretch in width and height to stay fullscreen. This works for the current page.
But when I flick to the next page, the layout is broken, as it was prefetched before and also layouted by an automatic call to layoutSubviews
.
I guess the origin is not updated right on the next page on rotation, or something like that.
Has someone a hint on how I can avoid this problem (other than not using Landscape)? And is this a bug in Nimbus?
EDIT: I discovered that NIPagingScrollView
provides the methods willRotateToInterfaceOrientation:duration:
and willAnimateRotationToInterfaceOrientation:duration:
which should be called by the view controller. I implemented these calls, but it still does not help.
Indeed
NIPagingScrollView
provides those methods, but if you look at them, you'll see that the layout computations are based on the scrollview frame values.So if you want the correct values to be given to your paging scroll view, just for example, the frame or your main view (the controller view) to the paging scroll view (_scrollView in the example).
That way, just before the animation, your paging scroll view will have the correct waited frame, and your layout will be recomputed correctly.