CocoaBloc-Camera 0.1.7

CocoaBloc-Camera 0.1.7

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Apr 2015

Maintained by Mark Glagola, John Heaton, David Warner.



 
Depends on:
pop~> 1.0
ReactiveCocoa~> 2.0
PureLayout~> 2.0
CocoaBloc-UI~> 0.0.3
 

  • By
  • John Heaton, Mark Glagola, David Warner and Josh Holat

Installation

CocoaBloc-Camera is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'CocoaBloc-Camera'

Getting Started

Implementing CococaBloc-Camera:

  1. Init a SBCameraViewController
  2. Set the SBCameraViewController's delegate.
  3. Present the SBCameraViewController.
  4. Handle SBCaptureViewControllerDelegate callbacks.

Example Implementation

@implementation ViewController

. . .

//create an SBCameraViewController
- (void)launchCameraController {
    // ===> 1. Init a `SBCameraViewController`
    SBCameraViewController *cameraController = [[SBCameraViewController alloc] initWithReviewOptions:reviewOptions initialCaptureType:SBCaptureTypeVideo];

    // ===> 2. Set the `SBCameraViewController's` `delegate`.
    cameraController.captureDelegate = self;

    // ===> 3. Present the `SBCameraViewController`.
    [self presentViewController:cameraController animated:YES completion:nil];
}

. . .

// ===> 4. Handle `SBCaptureViewControllerDelegate` callbacks.
#pragma mark - SBCaptureViewControllerDelegate
- (void)cameraControllerCancelled:(SBCaptureViewController*)controller {
    //The user just attempted to close the controller.
    [self dismissViewControllerAnimated:YES completion:nil];
}

//The SBCaptureViewControllerDelegate protocol inherits from SBReviewControllerDelegate
//hence the different name "reviewController:..."
- (void)reviewController:(SBReviewController*)controller acceptedAsset:(SBAsset*)asset {

    //The user just accepted the SBAsset, do something with it!

    //This is also a good time to dismiss the SBCameraViewController you launched earlier.
    [self dismissViewControllerAnimated:YES completion:nil];
}

@end

Trying the Example Project

To try our example project, run the following via command line:

pod try 'CocoaBloc-Camera'

License

CocoaBloc-Camera is available under the MIT license. See the LICENSE file for more info.