1// Copyright 2018-present 650 Industries. All rights reserved. 2 3#import <ABI47_0_0EXScreenOrientation/NSString+UIInterfaceOrientationMask.h> 4 5@implementation NSString (UIInterfaceOrientationMask) 6 7- (UIInterfaceOrientationMask)toUIInterfaceOrientationMask 8{ 9#define RETURN_VALUE_CHECKED(OPTION) if ([self isEqualToString:@#OPTION]) { return OPTION; } 10 RETURN_VALUE_CHECKED(UIInterfaceOrientationMaskPortrait) 11 RETURN_VALUE_CHECKED(UIInterfaceOrientationMaskLandscapeLeft) 12 RETURN_VALUE_CHECKED(UIInterfaceOrientationMaskLandscapeRight) 13 RETURN_VALUE_CHECKED(UIInterfaceOrientationMaskPortraitUpsideDown) 14 RETURN_VALUE_CHECKED(UIInterfaceOrientationMaskLandscape) 15 RETURN_VALUE_CHECKED(UIInterfaceOrientationMaskAll) 16 RETURN_VALUE_CHECKED(UIInterfaceOrientationMaskAllButUpsideDown) 17#undef RETURN_VALUE_CHECKED 18 @throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"Invalid UIInterfaceOrientationMask value" userInfo:nil]; 19} 20 21@end 22