I am working on an universal app both for iPad and iPhone devices that supports both landscape and portrait mode. In landscape it has more buttons in addition to what is there in portrait mode.
For iPhone, i was able to design different layouts using storyboard and it works as expected for wC|hC , wC|hR, wR|hC.
But in case of iPad, i could not design different layouts as size classes are same wR|hR for both landscape and portrait.
I referred solutions discussed @Sizing class for iPad portrait and Landscape Modes , iPad Landscape and Portrait different layouts with Size Class & tried to use code below:
override func overrideTraitCollectionForChildViewController(childViewController: UIViewController) -> UITraitCollection? {
if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad &&
view.bounds.width > view.bounds.height {
let collections = [UITraitCollection(horizontalSizeClass: .Regular),
UITraitCollection(verticalSizeClass: .Compact)]
return UITraitCollection(traitsFromCollections: collections)
}
return super.overrideTraitCollectionForChildViewController(childViewController)
}
But this code was never called. What should be the better way to achieve this ?
Will changing traits programmatically for iPad has any impact on app approval process as Apple itself provides same size class for iPad in Landscape & Portrait.