My application has Tabbar
and Navigation
options. My problem is, when device is rotating to landscape, previous viewcontroller
viewwilltransitiontosize
is also calling
Let's explain the scenario,
The first screen is AssignmentViewController The second screen is SubmissionListViewController
Both class I have override viewwilltransitiontosize
method. when I rotate to landscape in the 2nd view controller time, it first calls AssignmentViewController's viewwilltransitiontosize
method then it calls SubmissionListViewController's viewwilltransitiontosize
here is my piece of code
override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
if UIDevice.currentDevice().orientation.isLandscape.boolValue {
print("Landscape")
self.navigationController?.setNavigationBarHidden(true, animated: false)
self.landscapeVideo()
self.tabBarController!.tabBar.hidden = true
} else {
print("Portrait")
self.navigationController?.setNavigationBarHidden(false, animated: false)
self.videoinPortraitMode()
self.tabBarController!.tabBar.hidden = false
}
}
any idea or help please?