Snapchat-Like Image Capture Library
For questions or general comments regarding the use of this library, please use our public hipchat room.
If you find any bugs or have a problem while using this library, please open an issue in this repo (or a pull request :)).
And you can check all of our open-source projects at inaka.github.io
- Copy
IKCapture.h
andIKCapture.m
to your project. - Create a new
IKCapture
instance:
self.captureView = [[IKCapture alloc] initWithFrame:self.view.frame];
- Start capture:
[self.captureView startRunning];
- Add
IKCapture
to your view:
[self.view addSubview:self.captureView];
After finishing this steps you will have a view showing the camera preview.
@property (nonatomic,readonly,getter=isFlashOn) BOOL flashON;
This property lets you know if the flash is on in the current AVCaptureDevice
@property (nonatomic,strong) UIView *overlay;
This property lets you add an overlay to the camera view.
+(BOOL)isCameraAvailable;
This lets you know if a camera is available. If you are using the simulator or an old iphone this will return NO.
-(void)takeSnapshotWithCompletionHandler:(void (^)(UIImage
*image))completion;
To snap a picture just call this method. The image will be returned in the completion handler.
-(void)changeCamera;
This methods allows you to swap cameras.
-(void)toggleFlash;
This methods allows you to turn on/off the camera flash if available.
-(void)startRunning;
This method starts the AVCaptureSession
-(void)stopRunning;
This method stops the AVCaptureSession
-(void)setOverlay:(UIView*)overlay;
Allows you to set a UIView as an overlay to the camera viewfinder.
-(BOOL)currentCameraHasFlash;
This lets you know if the current camera owns a flash.