cocoapriest
cocoapriest

Reputation: 1859

How to tell the target interfaceOrientation in iOS 8?

Since willAnimateRotationToInterfaceOrientation is deprecated in iOS 8 (and we should use - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator), how do I know the interfaceOrientation the user is going to rotate?

Yes, I could read the size value to know proportions, but it doesn't tell me the difference between UIInterfaceOrientationLandscapeLeft and UIInterfaceOrientationLandscapeRight.

Upvotes: 1

Views: 253

Answers (1)

matt
matt

Reputation: 535890

As you rightly say, you are receiving this event:

- (void)viewWillTransitionToSize:(CGSize)size 
    withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator)

The second parameter is a transition coordinator. Use it! It has a targetTransform property that tells you what's about to happen.

Upvotes: 2

Related Questions