MotionOrientation
MotionOrientation copied to clipboard
Fix use of UIInterfaceOrientation constants
According to the documentation, UIDeviceOrientationLandscapeLeft and UIInterfaceOrientationLandscapeLeft are not the same. In fact, they are the exact opposite.
Take a look at the definition of UIInterfaceOrientation:
// Note that UIInterfaceOrientationLandscapeLeft is equal to UIDeviceOrientationLandscapeRight (and vice versa).
// This is because rotating the device to the left requires rotating the content to the right.
typedef NS_ENUM(NSInteger, UIInterfaceOrientation) {
UIInterfaceOrientationUnknown = UIDeviceOrientationUnknown,
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,
UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,
UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft
};
That being said, I noticed that when newInterfaceOrientation
was being calculated in MotionOrientation.m:179 and MotionOrientation.m:197
, the constant was not being flipped.
This fix also affected - (CGAffineTransform)affineTransform
, which was also fixed.