Created
June 29, 2017 09:10
-
-
Save WhiteTeeth/e3c8f05ff56cfd26382bbb220af6eb12 to your computer and use it in GitHub Desktop.
相机预览 View
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 <UIKit/UIKit.h> | |
#import <AVFoundation/AVCaptureSession.h> | |
@interface AVCamPreviewView : UIView | |
@property (nonatomic, readonly) AVCaptureVideoPreviewLayer *videoPreviewLayer; | |
@property (nonatomic) AVCaptureSession *session; | |
@end |
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 "AVCamPreviewView.h" | |
#import <AVFoundation/AVFoundation.h> | |
@implementation AVCamPreviewView | |
+ (Class)layerClass | |
{ | |
return [AVCaptureVideoPreviewLayer class]; | |
} | |
- (AVCaptureVideoPreviewLayer *)videoPreviewLayer | |
{ | |
return (AVCaptureVideoPreviewLayer *)self.layer; | |
} | |
- (AVCaptureSession *)session | |
{ | |
return self.videoPreviewLayer.session; | |
} | |
- (void)setSession:(AVCaptureSession *)session | |
{ | |
self.videoPreviewLayer.session = session; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment