diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2017-12-12 15:24:38 -0500 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2017-12-12 15:24:38 -0500 |
commit | 3fbd44329340096fab684b3f97971c883b707039 (patch) | |
tree | 030fbff7626bf6dff225be145f16b1c6b24b6ae8 | |
parent | 22a45dd698989e35cc230f25139aa7f4e0c9d49d (diff) | |
download | sdl_ios-3fbd44329340096fab684b3f97971c883b707039.tar.gz |
Check the set rootViewController to make sure it exists in only one possible orientation
-rwxr-xr-x | SmartDeviceLink/SDLCarWindow.m | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLCarWindow.m b/SmartDeviceLink/SDLCarWindow.m index 9d56ca80a..4752c7ca4 100755 --- a/SmartDeviceLink/SDLCarWindow.m +++ b/SmartDeviceLink/SDLCarWindow.m @@ -149,6 +149,21 @@ NS_ASSUME_NONNULL_BEGIN }); } +#pragma mark - Custom Accessors +- (void)setRootViewController:(nullable UIViewController *)rootViewController { + if (rootViewController == nil) { + return; + } + + if (!(rootViewController.supportedInterfaceOrientations == UIInterfaceOrientationPortrait || + rootViewController.supportedInterfaceOrientations == UIInterfaceOrientationLandscapeLeft || + rootViewController.supportedInterfaceOrientations == UIInterfaceOrientationLandscapeRight)) { + NSAssert((rootViewController.supportedInterfaceOrientations == UIInterfaceOrientationPortrait || + rootViewController.supportedInterfaceOrientations == UIInterfaceOrientationLandscapeLeft || + rootViewController.supportedInterfaceOrientations == UIInterfaceOrientationLandscapeRight), @"SDLCarWindow rootViewController must support only a single interface orientation"); + } +} + #pragma mark - Private Helpers + (CVPixelBufferRef)sdl_pixelBufferForImageRef:(CGImageRef)imageRef usingPool:(CVPixelBufferPoolRef)pool { CGFloat imageWidth = CGImageGetWidth(imageRef); |