I have two view controllers (ViewController1 and ViewController2), in which ViewController1 has a modal segue to ViewController2, and ViewController2 can be dismissed back to ViewController1.
If I follow these steps:
ViewController1—rotate to landscape—modal to VC2—ViewController2—rotate to portrait—dismiss to VC1
Then, in ViewController1's viewWillAppear
, I print view.frame.size
and I get this (running on iPhone 6s simulator):
(667.0, 375.0)
So that means the width is longer than the height, or that it is still in landscape.
That tells me that ViewController1 hasn't rotated yet, which makes sense, since this is in viewWillAppear
.
My current options (that I know of):
Use
viewDidAppear
— not preferred since I am reloading a collection view here and the change will be noticeable.Create an unwind segue — not preferred since this requires storyboards.
So what are my other options? Is there a view controller method that will best fit my needs?