I have doubt in using 2 XIb's for one class changing on orientations for Ipad. Is it right practice to do? For Ipad in Portrait mode I have one design and for landscape mode I have different design (little similar to portrait, but can't adjust' in portrait). Can I do everything in programming or its fine in using 2 Xib's, what are the complexities or issues I should face in using 2 Xib's?
Make sure that Rotation Lock is off: Swipe down from the top-right corner of your screen to open Control Center. Then tap the Rotation Lock button to make sure it's off.
If you're asking if using two NIBs for your orientations is standard practice then the answer is no.
If your UIs for landscape and portrait are radically different then it would be a more acceptable approach. But you could easily just use a single NIB with two views inside it (one for landscape, one for portrait) instead.
The accepted design pattern that Apple put forward is your view controller manages both landscape and portrait orientations, and either adjusts its view (using autoresizing masks, and also hooking into the various delegate methods triggered upon rotation to add/remove/animate views) or replaces the view with something else.
If your landscape/portrait views are quite different I'd recommend having a single NIB with two views inside it (one for landscape, one for portrait) and adding/removing those two views inside your view controller when you detect rotation.
'Standard practice' is always quite difficult to define, and perhaps some people will disagree with me, but I certainly haven't seen any apps that use two NIBs for their landscape/portrait orientations, and I haven't seen any Apple sample code that does it either. Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With