Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions YCameraViewController/YCameraViewController.m
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ @interface YCameraViewController (){
@implementation YCameraViewController
@synthesize delegate;

static NSString * nibName = @"YCameraViewController";

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
Expand All @@ -29,6 +31,25 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
return self;
}

//Designated initializer. External classes should not need to know the nib name to instantiate the CameraController, so we define it internally
-(instancetype)init
{
//when using frameworks, the bundle needs to be specified
NSBundle * bundle = [NSBundle bundleForClass:self.class];

self = [super initWithNibName:nibName bundle:bundle];
if (self) {
// Custom initialization
}
return self;
}

//Hide status bar. otherwise, it will interfere with camera UI.
-(BOOL)prefersStatusBarHidden {

return YES;
}

- (void)viewDidLoad
{
[super viewDidLoad];
Expand Down Expand Up @@ -584,15 +605,27 @@ - (IBAction)toogleFlash:(UIButton *)sender{
#pragma mark - UI Control Helpers
- (void)hideControllers{
[UIView animateWithDuration:0.2 animations:^{
//1)animate them out of screen
self.photoBar.center = CGPointMake(self.photoBar.center.x, self.photoBar.center.y+116.0);
self.topBar.center = CGPointMake(self.topBar.center.x, self.topBar.center.y-44.0);

//2)actually hide them
self.photoBar.alpha = 0.0;
self.topBar.alpha = 0.0;

} completion:nil];
}

- (void)showControllers{
[UIView animateWithDuration:0.2 animations:^{
//1)animate them into screen
self.photoBar.center = CGPointMake(self.photoBar.center.x, self.photoBar.center.y-116.0);
self.topBar.center = CGPointMake(self.topBar.center.x, self.topBar.center.y+44.0);

//2)actually show them
self.photoBar.alpha = 1.0;
self.topBar.alpha = 1.0;

} completion:nil];
}

Expand Down
Loading