Everybody love iOS interface and its "magic" appeal: fluid rotations, fluid swipe, ecc. A iOS programmer knows that there's a lot of work under that magic. If you try to realize a simple image gallery, you'll have some surprises when you'll try to rotate it:
- your image will not be located on view's center, but on a corner.
- if you forced your gallery to scroll to a certain page with scrollToRect, then you'll see all your precedent images in a fast scroll, even if you set parameter Animated to NO
- if you need to scroll after rotation, you'll see a rotation around a corner
- Point 1: when detecting a rotation, (willRotateToInterfaceOrientation), you have to resize:
- Images on the scrollview
- scrollview content
- Points 2 & 3: you must cover gallery's scrollview with a UIImageView containing current gallery image, hiding all scrollview animations. The "cover" will rotate around screen center, giving a more professional (and Apple) look.
No comments:
Post a Comment