From bb52448806c5074a28b1442c5daecc9e0a2048c0 Mon Sep 17 00:00:00 2001 From: Roberto Arreaza Date: Wed, 4 Mar 2015 19:53:33 +0100 Subject: [PATCH 1/6] updated podspec to point to fork --- YCameraView.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/YCameraView.podspec b/YCameraView.podspec index e637db7..7529ea4 100644 --- a/YCameraView.podspec +++ b/YCameraView.podspec @@ -18,7 +18,7 @@ Pod::Spec.new do |s| s.license = { :type => "MIT", :file => "LICENSE" } s.author = "yuvirajsinh" s.platform = :ios, '7.0' - s.source = { :git => "https://github.com/yuvirajsinh/YCameraView.git", :tag => s.version.to_s } + s.source = { :git => "https://github.com/robertibiris/YCameraView.git", :tag => s.version.to_s } s.source_files = "YCameraViewController/**/*.{h,m}" s.resources = ["YCameraViewController/UI/**/*.png", "YCameraViewController/YCameraViewController.xib"] From 23002db42b91fe1b5dc4ae814c4d537f5d5583e8 Mon Sep 17 00:00:00 2001 From: Roberto Arreaza Date: Wed, 4 Mar 2015 20:05:46 +0100 Subject: [PATCH 2/6] -added changes for iPhone6 support into the actual files (the ones used by the demo are different than those included in the cocoa pods repo, hence the confusion --- YCameraViewController/YCameraViewController.m | 12 + .../YCameraViewController.xib | 673 +++++++++++++++--- 2 files changed, 586 insertions(+), 99 deletions(-) mode change 100755 => 100644 YCameraViewController/YCameraViewController.m diff --git a/YCameraViewController/YCameraViewController.m b/YCameraViewController/YCameraViewController.m old mode 100755 new mode 100644 index 4a6eb5c..b2a2386 --- a/YCameraViewController/YCameraViewController.m +++ b/YCameraViewController/YCameraViewController.m @@ -584,15 +584,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]; } diff --git a/YCameraViewController/YCameraViewController.xib b/YCameraViewController/YCameraViewController.xib index fea0f4d..4759a1e 100755 --- a/YCameraViewController/YCameraViewController.xib +++ b/YCameraViewController/YCameraViewController.xib @@ -1,202 +1,677 @@ - + - - + + + - - - - - - - - - - - + + + + + + + + + + + - - + + - - - + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -205,4 +680,4 @@ - \ No newline at end of file + From 09b7269e895b85c103cca26f2a7b8608544d3362 Mon Sep 17 00:00:00 2001 From: Roberto Arreaza Date: Wed, 4 Mar 2015 20:26:41 +0100 Subject: [PATCH 3/6] changed back the source to the original repo to prepare of pull request --- YCameraView.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/YCameraView.podspec b/YCameraView.podspec index 7529ea4..e637db7 100644 --- a/YCameraView.podspec +++ b/YCameraView.podspec @@ -18,7 +18,7 @@ Pod::Spec.new do |s| s.license = { :type => "MIT", :file => "LICENSE" } s.author = "yuvirajsinh" s.platform = :ios, '7.0' - s.source = { :git => "https://github.com/robertibiris/YCameraView.git", :tag => s.version.to_s } + s.source = { :git => "https://github.com/yuvirajsinh/YCameraView.git", :tag => s.version.to_s } s.source_files = "YCameraViewController/**/*.{h,m}" s.resources = ["YCameraViewController/UI/**/*.png", "YCameraViewController/YCameraViewController.xib"] From c81221a7d61ac4453382a344871c8c7c6588048d Mon Sep 17 00:00:00 2001 From: Roberto Arreaza Date: Thu, 24 Dec 2015 17:19:28 +0100 Subject: [PATCH 4/6] -improvements so External classes do not need to know the nib name for the cameraController. -status bar hidden when showing cameraController --- YImagePickerDemo/YImagePickerDemo/ViewController.m | 2 +- .../YCameraViewController/YCameraViewController.m | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/YImagePickerDemo/YImagePickerDemo/ViewController.m b/YImagePickerDemo/YImagePickerDemo/ViewController.m index 4a064c6..0bd2633 100644 --- a/YImagePickerDemo/YImagePickerDemo/ViewController.m +++ b/YImagePickerDemo/YImagePickerDemo/ViewController.m @@ -29,7 +29,7 @@ - (void)didReceiveMemoryWarning #pragma mark - Button clicks - (IBAction)takePhoto:(id)sender{ - YCameraViewController *camController = [[YCameraViewController alloc] initWithNibName:@"YCameraViewController" bundle:nil]; + YCameraViewController *camController = [[YCameraViewController alloc] init]; camController.delegate=self; [self presentViewController:camController animated:YES completion:^{ // completion code diff --git a/YImagePickerDemo/YImagePickerDemo/YCameraViewController/YCameraViewController.m b/YImagePickerDemo/YImagePickerDemo/YCameraViewController/YCameraViewController.m index 0be9e21..852ecd8 100644 --- a/YImagePickerDemo/YImagePickerDemo/YCameraViewController/YCameraViewController.m +++ b/YImagePickerDemo/YImagePickerDemo/YCameraViewController/YCameraViewController.m @@ -12,6 +12,7 @@ #define DegreesToRadians(x) ((x) * M_PI / 180.0) + @interface YCameraViewController (){ UIInterfaceOrientation orientationLast, orientationAfterProcess; CMMotionManager *motionManager; @@ -21,15 +22,24 @@ @interface YCameraViewController (){ @implementation YCameraViewController @synthesize delegate; -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +static NSString * nibName = @"YCameraViewController"; + +//Designated initializer. External classes should not need to know the nib name to instantiate the CameraController, so we define it internally +-(instancetype)init { - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + self = [super initWithNibName:nibName bundle:nil]; if (self) { // Custom initialization } return self; } +//Hide status bar. otherwise, it will interfere with camera UI. +-(BOOL)prefersStatusBarHidden { + + return YES; +} + - (void)viewDidLoad { [super viewDidLoad]; From 016c3594bc2c93db221755dcb6b8e28cec53c93b Mon Sep 17 00:00:00 2001 From: Roberto Arreaza Date: Thu, 24 Dec 2015 17:32:17 +0100 Subject: [PATCH 5/6] -updated actual file included in podspec --- YCameraViewController/YCameraViewController.m | 18 ++++++++++++++++++ .../YCameraViewController.m | 9 +++++++++ 2 files changed, 27 insertions(+) diff --git a/YCameraViewController/YCameraViewController.m b/YCameraViewController/YCameraViewController.m index b2a2386..b990f6a 100644 --- a/YCameraViewController/YCameraViewController.m +++ b/YCameraViewController/YCameraViewController.m @@ -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]; @@ -29,6 +31,22 @@ - (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 +{ + self = [super initWithNibName:nibName bundle:nil]; + if (self) { + // Custom initialization + } + return self; +} + +//Hide status bar. otherwise, it will interfere with camera UI. +-(BOOL)prefersStatusBarHidden { + + return YES; +} + - (void)viewDidLoad { [super viewDidLoad]; diff --git a/YImagePickerDemo/YImagePickerDemo/YCameraViewController/YCameraViewController.m b/YImagePickerDemo/YImagePickerDemo/YCameraViewController/YCameraViewController.m index 852ecd8..6d22e9e 100644 --- a/YImagePickerDemo/YImagePickerDemo/YCameraViewController/YCameraViewController.m +++ b/YImagePickerDemo/YImagePickerDemo/YCameraViewController/YCameraViewController.m @@ -24,6 +24,15 @@ @implementation YCameraViewController static NSString * nibName = @"YCameraViewController"; +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + // Custom initialization + } + 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 { From 0114280d2bb532828e741548d9f4452dd6e23747 Mon Sep 17 00:00:00 2001 From: Roberto Arreaza Date: Thu, 24 Dec 2015 17:57:02 +0100 Subject: [PATCH 6/6] -fix to YCameraViewController bundle reference so code runs in projects using Frameworks feature --- YCameraViewController/YCameraViewController.m | 5 ++++- .../YCameraViewController/YCameraViewController.m | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/YCameraViewController/YCameraViewController.m b/YCameraViewController/YCameraViewController.m index b990f6a..b6ddcb4 100644 --- a/YCameraViewController/YCameraViewController.m +++ b/YCameraViewController/YCameraViewController.m @@ -34,7 +34,10 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil //Designated initializer. External classes should not need to know the nib name to instantiate the CameraController, so we define it internally -(instancetype)init { - self = [super initWithNibName:nibName bundle:nil]; + //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 } diff --git a/YImagePickerDemo/YImagePickerDemo/YCameraViewController/YCameraViewController.m b/YImagePickerDemo/YImagePickerDemo/YCameraViewController/YCameraViewController.m index 6d22e9e..e8ff689 100644 --- a/YImagePickerDemo/YImagePickerDemo/YCameraViewController/YCameraViewController.m +++ b/YImagePickerDemo/YImagePickerDemo/YCameraViewController/YCameraViewController.m @@ -36,7 +36,10 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil //Designated initializer. External classes should not need to know the nib name to instantiate the CameraController, so we define it internally -(instancetype)init { - self = [super initWithNibName:nibName bundle:nil]; + //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 }