I've been looking for a great pattern to deal with the orientations on the iPad without any luck. I know that there are already a lot of topics about this on stackoverflow but no one is really great so don't waste your time adding this topic as a duplicate.
As any iPad application, you have to deal with (at least) 2 orientations (landscape and portrait).
How are you dealing with this ?
- Do you use two different ViewController ?
- Do you use the
willRotat开发者_如何转开发eToInterfaceOrientation:duration
methods ? - How do you avoid duplicate code ?
Thanks
You won't find a single pattern because the best method varies depending on the needs of each particular app.
If the views are simple, then rotating the view's elements takes little code. If the views are complex and/or the elements change between orientations, then I would recommend using two view controllers.
You can avoid duplicate code in multiple controllers by creating a super class for the controllers that contains all the shared functionality. If you use nibs, you will often find you need only change the nib file for each subclass.
精彩评论