This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { | |
if ([_currentViewController class] == [PortraitViewController class]) { | |
return UIInterfaceOrientationMaskPortrait; | |
} else { | |
return UIInterfaceOrientationMaskLandscape; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef NS_OPTIONS(NSUInteger, UIInterfaceOrientationMask) { | |
UIInterfaceOrientationMaskPortrait = (1 << UIInterfaceOrientationPortrait), | |
UIInterfaceOrientationMaskLandscapeLeft = (1 << UIInterfaceOrientationLandscapeLeft), | |
UIInterfaceOrientationMaskLandscapeRight = (1 << UIInterfaceOrientationLandscapeRight), | |
UIInterfaceOrientationMaskPortraitUpsideDown = (1 << UIInterfaceOrientationPortraitUpsideDown), | |
UIInterfaceOrientationMaskLandscape = (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight), | |
UIInterfaceOrientationMaskAll = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown), | |
UIInterfaceOrientationMaskAllButUpsideDown = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight), | |
} __TVOS_PROHIBITED; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { | |
// is called when the interface orientation is changed | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<key>UISupportedInterfaceOrientations</key> | |
<array> | |
<string>UIInterfaceOrientationLandscapeRight</string> | |
<string>UIInterfaceOrientationLandscapeLeft</string> | |
</array> | |
<key>UISupportedInterfaceOrientations~ipad</key> | |
<array> | |
<string>UIInterfaceOrientationLandscapeRight</string> | |
<string>UIInterfaceOrientationLandscapeLeft</string> | |
</array> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
} __TVOS_PROHIBITED; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef NS_ENUM(NSInteger, UIDeviceOrientation) { | |
UIDeviceOrientationUnknown, | |
UIDeviceOrientationPortrait, // Device oriented vertically, home button on the bottom | |
UIDeviceOrientationPortraitUpsideDown, // Device oriented vertically, home button on the top | |
UIDeviceOrientationLandscapeLeft, // Device oriented horizontally, home button on the right | |
UIDeviceOrientationLandscapeRight, // Device oriented horizontally, home button on the left | |
UIDeviceOrientationFaceUp, // Device oriented flat, face up | |
UIDeviceOrientationFaceDown // Device oriented flat, face down | |
} __TVOS_PROHIBITED; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AVFoundation | |
func cameraOn() { | |
let status = AVCaptureDevice.authorizationStatus(for: .video) | |
switch status { | |
case .authroized: | |
// has alraedy approved the privacy | |
// open your camera(UIImagePickerController) | |
break | |
default: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AVFoundation | |
func cameraOn() { | |
AVCaptureDevice.requestAccess(for: .video, completionHandler: { granted in | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef DEBUG | |
[_debugLabel setHidden:NO]; | |
#else | |
[_debugLabel setHidden:YES]; | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define CLASSNAME(x) NSStringFromClass([x class]) | |
NSLog(@"NSString:%@", CLASSNAME([NSString string])); | |
NSLog(@"NSMutableString:%@", CLASSNAME([NSMutableString string])); | |
#undef CLS |