From a7ff434ee2f3705cda2150fa12af5831a90dc63a Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Sun, 10 Nov 2013 21:14:18 +0800 Subject: [PATCH 01/25] Makes the toolbar height a constant, placing it in GKImageCropView for now (might not be the best place) and #import-ing it where necessary. --- GKClasses/GKImageCropOverlayView.m | 3 ++- GKClasses/GKImageCropView.h | 2 ++ GKClasses/GKImageCropView.m | 2 +- GKClasses/GKImageCropViewController.m | 6 +++--- GKClasses/GKResizeableCropOverlayView.m | 7 ++++--- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/GKClasses/GKImageCropOverlayView.m b/GKClasses/GKImageCropOverlayView.m index a103a48..bb3e999 100644 --- a/GKClasses/GKImageCropOverlayView.m +++ b/GKClasses/GKImageCropOverlayView.m @@ -7,6 +7,7 @@ // #import "GKImageCropOverlayView.h" +#import "GKImageCropView.h" @interface GKImageCropOverlayView () @property (nonatomic, strong) UIToolbar *toolbar; @@ -40,7 +41,7 @@ - (id)initWithFrame:(CGRect)frame{ - (void)drawRect:(CGRect)rect{ - CGFloat toolbarSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 0 : 54; + CGFloat toolbarSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 0 : TOOLBAR_HEIGHT; CGFloat width = CGRectGetWidth(self.frame); CGFloat height = CGRectGetHeight(self.frame) - toolbarSize; diff --git a/GKClasses/GKImageCropView.h b/GKClasses/GKImageCropView.h index 2ace14b..afbddcb 100644 --- a/GKClasses/GKImageCropView.h +++ b/GKClasses/GKImageCropView.h @@ -8,6 +8,8 @@ #import +#define TOOLBAR_HEIGHT 54.f + @interface GKImageCropView : UIView @property (nonatomic, strong) UIImage *imageToCrop; diff --git a/GKClasses/GKImageCropView.m b/GKClasses/GKImageCropView.m index f0e1d01..5c32695 100644 --- a/GKClasses/GKImageCropView.m +++ b/GKClasses/GKImageCropView.m @@ -229,7 +229,7 @@ - (void)layoutSubviews{ [super layoutSubviews]; CGSize size = self.cropSize; - CGFloat toolbarSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 0 : 54; + CGFloat toolbarSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 0 : TOOLBAR_HEIGHT; self.xOffset = floor((CGRectGetWidth(self.bounds) - size.width) * 0.5); self.yOffset = floor((CGRectGetHeight(self.bounds) - toolbarSize - size.height) * 0.5); //fixed diff --git a/GKClasses/GKImageCropViewController.m b/GKClasses/GKImageCropViewController.m index 64f4bfc..bd0171e 100644 --- a/GKClasses/GKImageCropViewController.m +++ b/GKClasses/GKImageCropViewController.m @@ -110,13 +110,13 @@ - (UIImage *)_toolbarBackgroundImage{ 123./255., 125/255., 132./255., 1. }; - UIGraphicsBeginImageContextWithOptions(CGSizeMake(320, 54), YES, 0.0); + UIGraphicsBeginImageContextWithOptions(CGSizeMake(320, TOOLBAR_HEIGHT), YES, 0.0); CGContextRef ctx = UIGraphicsGetCurrentContext(); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, components, NULL, 2); - CGContextDrawLinearGradient(ctx, gradient, CGPointMake(0, 0), CGPointMake(0, 54), kCGImageAlphaNoneSkipFirst); + CGContextDrawLinearGradient(ctx, gradient, CGPointMake(0, 0), CGPointMake(0, TOOLBAR_HEIGHT), kCGImageAlphaNoneSkipFirst); UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); @@ -191,7 +191,7 @@ - (void)viewWillLayoutSubviews{ [super viewWillLayoutSubviews]; self.imageCropView.frame = self.view.bounds; - self.toolbar.frame = CGRectMake(0, CGRectGetHeight(self.view.frame) - 54, 320, 54); + self.toolbar.frame = CGRectMake(0, CGRectGetHeight(self.view.frame) - TOOLBAR_HEIGHT, 320, TOOLBAR_HEIGHT); } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation diff --git a/GKClasses/GKResizeableCropOverlayView.m b/GKClasses/GKResizeableCropOverlayView.m index 97b98f6..3670db7 100644 --- a/GKClasses/GKResizeableCropOverlayView.m +++ b/GKClasses/GKResizeableCropOverlayView.m @@ -8,6 +8,7 @@ #import "GKResizeableCropOverlayView.h" #import "GKCropBorderView.h" +#import "GKImageCropView.h" #define kBorderCorrectionValue 12 @@ -41,7 +42,7 @@ @implementation GKResizeableCropOverlayView -(void)setFrame:(CGRect)frame{ [super setFrame:frame]; - CGFloat toolbarSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 0 : 54; + CGFloat toolbarSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 0 : TOOLBAR_HEIGHT; _contentView.frame = CGRectMake(self.bounds.size.width / 2 - _initialContentSize.width / 2 , (self.bounds.size.height - toolbarSize) / 2 - _initialContentSize.height / 2 , _initialContentSize.width, _initialContentSize.height); _cropBorderView.frame = CGRectMake(self.bounds.size.width / 2 - _initialContentSize.width / 2 - kBorderCorrectionValue, (self.bounds.size.height - toolbarSize) / 2 - _initialContentSize.height / 2 - kBorderCorrectionValue, _initialContentSize.width + kBorderCorrectionValue*2, _initialContentSize.height + kBorderCorrectionValue*2); } @@ -93,7 +94,7 @@ -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ #pragma private -(void)_addContentViews{ - CGFloat toolbarSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 0 : 54; + CGFloat toolbarSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 0 : TOOLBAR_HEIGHT; _contentView = [[UIView alloc] initWithFrame:CGRectMake(self.bounds.size.width / 2 - _initialContentSize.width / 2 , (self.bounds.size.height - toolbarSize) / 2 - _initialContentSize.height / 2 , _initialContentSize.width, _initialContentSize.height)]; _contentView.backgroundColor = [UIColor clearColor]; @@ -178,7 +179,7 @@ -(void)_resizeWithTouchPoint:(CGPoint)point{ } -(CGRect)_preventBorderFrameFromGettingTooSmallOrTooBig:(CGRect)newFrame{ - CGFloat toolbarSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 0 : 54; + CGFloat toolbarSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 0 : TOOLBAR_HEIGHT; if (newFrame.size.width < 64) { newFrame.size.width = _cropBorderView.frame.size.width; From 865001248e127ae80805800fc8576acf01d8ed53 Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Sun, 10 Nov 2013 22:11:32 +0800 Subject: [PATCH 02/25] Makes style of image cropper more iOS7-ish --- GKClasses/GKImageCropView.h | 2 +- GKClasses/GKImageCropViewController.m | 104 +- GKImagePicker.xcodeproj/project.pbxproj | 1511 ++++++----------------- 3 files changed, 446 insertions(+), 1171 deletions(-) diff --git a/GKClasses/GKImageCropView.h b/GKClasses/GKImageCropView.h index afbddcb..14c2349 100644 --- a/GKClasses/GKImageCropView.h +++ b/GKClasses/GKImageCropView.h @@ -8,7 +8,7 @@ #import -#define TOOLBAR_HEIGHT 54.f +#define TOOLBAR_HEIGHT 72.f @interface GKImageCropView : UIView diff --git a/GKClasses/GKImageCropViewController.m b/GKClasses/GKImageCropViewController.m index bd0171e..42d9b84 100644 --- a/GKClasses/GKImageCropViewController.m +++ b/GKClasses/GKImageCropViewController.m @@ -9,10 +9,12 @@ #import "GKImageCropViewController.h" #import "GKImageCropView.h" +#define HORIZONTAL_TEXT_PADDING 13.f + @interface GKImageCropViewController () @property (nonatomic, strong) GKImageCropView *imageCropView; -@property (nonatomic, strong) UIToolbar *toolbar; +@property (nonatomic, strong) UIView *toolbarView; @property (nonatomic, strong) UIButton *cancelButton; @property (nonatomic, strong) UIButton *useButton; @@ -30,7 +32,7 @@ @implementation GKImageCropViewController @synthesize sourceImage, cropSize, delegate; @synthesize imageCropView; -@synthesize toolbar; +@synthesize toolbarView; @synthesize cancelButton, useButton, resizeableCropArea; #pragma mark - @@ -70,90 +72,68 @@ - (void)_setupCropView{ [self.view addSubview:self.imageCropView]; } +- (CGSize)sizeForString:(NSString *)string withFont:(UIFont *)font{ + NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init]; + attributes[NSFontAttributeName] = font; + CGRect labelRect = [string boundingRectWithSize:CGSizeMake(320.f, TOOLBAR_HEIGHT) + options:NSStringDrawingUsesLineFragmentOrigin + attributes:attributes + context:nil]; + return CGSizeMake(labelRect.size.width, TOOLBAR_HEIGHT); +} + +- (UIFont *)buttonFont +{ + return [UIFont systemFontOfSize:18.f]; +} + - (void)_setupCancelButton{ + CGSize buttonSize = [self sizeForString:NSLocalizedString(@"GKIcancel",@"") + withFont:[self buttonFont]]; self.cancelButton = [UIButton buttonWithType:UIButtonTypeCustom]; - - [self.cancelButton setBackgroundImage:[[UIImage imageNamed:@"PLCameraSheetButton.png"] stretchableImageWithLeftCapWidth:5 topCapHeight:0] forState:UIControlStateNormal]; - [self.cancelButton setBackgroundImage:[[UIImage imageNamed:@"PLCameraSheetButtonPressed.png"] stretchableImageWithLeftCapWidth:5 topCapHeight:0] forState:UIControlStateHighlighted]; - - [[self.cancelButton titleLabel] setFont:[UIFont boldSystemFontOfSize:11]]; - [[self.cancelButton titleLabel] setShadowOffset:CGSizeMake(0, 1)]; - [self.cancelButton setFrame:CGRectMake(0, 0, 50, 30)]; + [[self.cancelButton titleLabel] setFont:[self buttonFont]]; + [self.cancelButton setFrame:CGRectMake(HORIZONTAL_TEXT_PADDING, 0, buttonSize.width, buttonSize.height)]; [self.cancelButton setTitle:NSLocalizedString(@"GKIcancel",@"") forState:UIControlStateNormal]; - [self.cancelButton setTitleColor:[UIColor colorWithRed:0.173 green:0.176 blue:0.176 alpha:1] forState:UIControlStateNormal]; - [self.cancelButton setTitleShadowColor:[UIColor colorWithRed:0.827 green:0.831 blue:0.839 alpha:1] forState:UIControlStateNormal]; + [self.cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlEventAllEvents]; [self.cancelButton addTarget:self action:@selector(_actionCancel) forControlEvents:UIControlEventTouchUpInside]; - } - (void)_setupUseButton{ + CGSize buttonSize = [self sizeForString:NSLocalizedString(@"GKIuse",@"") + withFont:[self buttonFont]]; self.useButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [self.useButton setBackgroundImage:[[UIImage imageNamed:@"PLCameraSheetDoneButton.png"] stretchableImageWithLeftCapWidth:5 topCapHeight:0] forState:UIControlStateNormal]; - [self.useButton setBackgroundImage:[[UIImage imageNamed:@"PLCameraSheetDoneButtonPressed.png"] stretchableImageWithLeftCapWidth:5 topCapHeight:0] forState:UIControlStateHighlighted]; - - [[self.useButton titleLabel] setFont:[UIFont boldSystemFontOfSize:11]]; - [[self.useButton titleLabel] setShadowOffset:CGSizeMake(0, -1)]; - [self.useButton setFrame:CGRectMake(0, 0, 50, 30)]; + [[self.useButton titleLabel] setFont:[self buttonFont]]; + [self.useButton setFrame:CGRectMake(self.view.frame.size.width - (buttonSize.width + HORIZONTAL_TEXT_PADDING), 0, buttonSize.width, buttonSize.height)]; [self.useButton setTitle:NSLocalizedString(@"GKIuse",@"") forState:UIControlStateNormal]; - [self.useButton setTitleShadowColor:[UIColor colorWithRed:0.118 green:0.247 blue:0.455 alpha:1] forState:UIControlStateNormal]; + [self.useButton setTitleColor:[UIColor whiteColor] forState:UIControlEventAllEvents]; [self.useButton addTarget:self action:@selector(_actionUse) forControlEvents:UIControlEventTouchUpInside]; - } -- (UIImage *)_toolbarBackgroundImage{ - - CGFloat components[] = { - 1., 1., 1., 1., - 123./255., 125/255., 132./255., 1. - }; - - UIGraphicsBeginImageContextWithOptions(CGSizeMake(320, TOOLBAR_HEIGHT), YES, 0.0); - - CGContextRef ctx = UIGraphicsGetCurrentContext(); - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, components, NULL, 2); - - CGContextDrawLinearGradient(ctx, gradient, CGPointMake(0, 0), CGPointMake(0, TOOLBAR_HEIGHT), kCGImageAlphaNoneSkipFirst); - - UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); - - CGGradientRelease(gradient); - CGColorSpaceRelease(colorSpace); - UIGraphicsEndImageContext(); - - return viewImage; -} - (void)_setupToolbar{ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { - self.toolbar = [[UIToolbar alloc] initWithFrame:CGRectZero]; - [self.toolbar setBackgroundImage:[self _toolbarBackgroundImage] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault]; - [self.view addSubview:self.toolbar]; + self.toolbarView = [[UIView alloc] initWithFrame:CGRectMake(0, + self.view.frame.size.height - TOOLBAR_HEIGHT, + self.view.frame.size.width, + TOOLBAR_HEIGHT)]; + self.toolbarView.backgroundColor = [UIColor colorWithRed:20./255. green:20./255. blue:20./255. alpha:0.65]; + [self.view addSubview:self.toolbarView]; [self _setupCancelButton]; [self _setupUseButton]; - UILabel *info = [[UILabel alloc] initWithFrame:CGRectZero]; - info.text = NSLocalizedString(@"GKImoveAndScale", @""); - info.textColor = [UIColor colorWithRed:0.173 green:0.173 blue:0.173 alpha:1]; - info.backgroundColor = [UIColor clearColor]; - info.shadowColor = [UIColor colorWithRed:0.827 green:0.831 blue:0.839 alpha:1]; - info.shadowOffset = CGSizeMake(0, 1); - info.font = [UIFont boldSystemFontOfSize:18]; - [info sizeToFit]; - - UIBarButtonItem *cancel = [[UIBarButtonItem alloc] initWithCustomView:self.cancelButton]; - UIBarButtonItem *flex = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; - UIBarButtonItem *lbl = [[UIBarButtonItem alloc] initWithCustomView:info]; - UIBarButtonItem *use = [[UIBarButtonItem alloc] initWithCustomView:self.useButton]; - - [self.toolbar setItems:[NSArray arrayWithObjects:cancel, flex, lbl, flex, use, nil]]; + [self.toolbarView addSubview:self.cancelButton]; + [self.toolbarView addSubview:self.useButton]; } } +- (BOOL)prefersStatusBarHidden { + return YES; +} + #pragma mark - #pragma Super Class Methods @@ -191,7 +171,7 @@ - (void)viewWillLayoutSubviews{ [super viewWillLayoutSubviews]; self.imageCropView.frame = self.view.bounds; - self.toolbar.frame = CGRectMake(0, CGRectGetHeight(self.view.frame) - TOOLBAR_HEIGHT, 320, TOOLBAR_HEIGHT); + self.toolbarView.frame = CGRectMake(0, CGRectGetHeight(self.view.frame) - TOOLBAR_HEIGHT, 320, TOOLBAR_HEIGHT); } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation diff --git a/GKImagePicker.xcodeproj/project.pbxproj b/GKImagePicker.xcodeproj/project.pbxproj index dcc1d0d..8fb8672 100644 --- a/GKImagePicker.xcodeproj/project.pbxproj +++ b/GKImagePicker.xcodeproj/project.pbxproj @@ -1,1108 +1,403 @@ - - - - - archiveVersion - 1 - classes - - objectVersion - 46 - objects - - C147FBF51677C12F0035B373 - - isa - PBXFileReference - lastKnownFileType - image.png - path - Default-568h@2x.png - sourceTree - <group> - - C147FBF61677C12F0035B373 - - fileRef - C147FBF51677C12F0035B373 - isa - PBXBuildFile - - C1C7B6531598429E007B2669 - - children - - C1C7B6681598429E007B2669 - C1C7B6611598429E007B2669 - C1C7B65F1598429E007B2669 - - isa - PBXGroup - sourceTree - <group> - - C1C7B6551598429E007B2669 - - attributes - - LastUpgradeCheck - 0450 - ORGANIZATIONNAME - Georg Kitz - - buildConfigurationList - C1C7B6581598429E007B2669 - compatibilityVersion - Xcode 3.2 - developmentRegion - English - hasScannedForEncodings - 0 - isa - PBXProject - knownRegions - - en - - mainGroup - C1C7B6531598429E007B2669 - productRefGroup - C1C7B65F1598429E007B2669 - projectDirPath - - projectReferences - - projectRoot - - targets - - C1C7B65D1598429E007B2669 - - - C1C7B6581598429E007B2669 - - buildConfigurations - - C1C7B67D1598429E007B2669 - C1C7B67E1598429E007B2669 - - defaultConfigurationIsVisible - 0 - defaultConfigurationName - Release - isa - XCConfigurationList - - C1C7B65A1598429E007B2669 - - buildActionMask - 2147483647 - files - - C1C7B6E515984465007B2669 - C1C7B6E615984465007B2669 - C1C7B6E715984465007B2669 - C1C7B6E815984465007B2669 - C1C7B6E41598445C007B2669 - C1C7B66F1598429E007B2669 - C1C7B6731598429E007B2669 - D696F4FA16111C28007802E6 - D6862A9216111C68005A5C5C - - isa - PBXSourcesBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - C1C7B65B1598429E007B2669 - - buildActionMask - 2147483647 - files - - C1C7B6631598429E007B2669 - C1C7B6651598429E007B2669 - C1C7B6671598429E007B2669 - - isa - PBXFrameworksBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - C1C7B65C1598429E007B2669 - - buildActionMask - 2147483647 - files - - C1C7B66D1598429E007B2669 - C1C7B6791598429E007B2669 - C1C7B67C1598429E007B2669 - C1C7B6D815984313007B2669 - C1C7B6D915984313007B2669 - C1C7B6DA15984313007B2669 - C1C7B6DB15984313007B2669 - C1C7B6DC15984313007B2669 - C1C7B6DD15984313007B2669 - C1C7B6DE15984313007B2669 - C1C7B6DF15984313007B2669 - C1C7B6E315984338007B2669 - C147FBF61677C12F0035B373 - - isa - PBXResourcesBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - C1C7B65D1598429E007B2669 - - buildConfigurationList - C1C7B67F1598429E007B2669 - buildPhases - - C1C7B65A1598429E007B2669 - C1C7B65B1598429E007B2669 - C1C7B65C1598429E007B2669 - - buildRules - - dependencies - - isa - PBXNativeTarget - name - GKImagePicker - productName - GKImagePicker - productReference - C1C7B65E1598429E007B2669 - productType - com.apple.product-type.application - - C1C7B65E1598429E007B2669 - - explicitFileType - wrapper.application - includeInIndex - 0 - isa - PBXFileReference - path - GKImagePicker.app - sourceTree - BUILT_PRODUCTS_DIR - - C1C7B65F1598429E007B2669 - - children - - C1C7B65E1598429E007B2669 - - isa - PBXGroup - name - Products - sourceTree - <group> - - C1C7B6611598429E007B2669 - - children - - C1C7B6621598429E007B2669 - C1C7B6641598429E007B2669 - C1C7B6661598429E007B2669 - - isa - PBXGroup - name - Frameworks - sourceTree - <group> - - C1C7B6621598429E007B2669 - - isa - PBXFileReference - lastKnownFileType - wrapper.framework - name - UIKit.framework - path - System/Library/Frameworks/UIKit.framework - sourceTree - SDKROOT - - C1C7B6631598429E007B2669 - - fileRef - C1C7B6621598429E007B2669 - isa - PBXBuildFile - - C1C7B6641598429E007B2669 - - isa - PBXFileReference - lastKnownFileType - wrapper.framework - name - Foundation.framework - path - System/Library/Frameworks/Foundation.framework - sourceTree - SDKROOT - - C1C7B6651598429E007B2669 - - fileRef - C1C7B6641598429E007B2669 - isa - PBXBuildFile - - C1C7B6661598429E007B2669 - - isa - PBXFileReference - lastKnownFileType - wrapper.framework - name - CoreGraphics.framework - path - System/Library/Frameworks/CoreGraphics.framework - sourceTree - SDKROOT - - C1C7B6671598429E007B2669 - - fileRef - C1C7B6661598429E007B2669 - isa - PBXBuildFile - - C1C7B6681598429E007B2669 - - children - - C1C7B6C6159842EA007B2669 - C1C7B6711598429E007B2669 - C1C7B6721598429E007B2669 - C1C7B6E015984328007B2669 - C1C7B6E115984328007B2669 - C1C7B6771598429E007B2669 - C1C7B67A1598429E007B2669 - C1C7B6691598429E007B2669 - - isa - PBXGroup - path - GKImagePicker - sourceTree - <group> - - C1C7B6691598429E007B2669 - - children - - C147FBF51677C12F0035B373 - C1C7B66A1598429E007B2669 - C1C7B66B1598429E007B2669 - C1C7B66E1598429E007B2669 - C1C7B6701598429E007B2669 - C1C7B6E215984338007B2669 - - isa - PBXGroup - name - Supporting Files - sourceTree - <group> - - C1C7B66A1598429E007B2669 - - isa - PBXFileReference - lastKnownFileType - text.plist.xml - path - GKImagePicker-Info.plist - sourceTree - <group> - - C1C7B66B1598429E007B2669 - - children - - C1C7B66C1598429E007B2669 - - isa - PBXVariantGroup - name - InfoPlist.strings - sourceTree - <group> - - C1C7B66C1598429E007B2669 - - isa - PBXFileReference - lastKnownFileType - text.plist.strings - name - en - path - en.lproj/InfoPlist.strings - sourceTree - <group> - - C1C7B66D1598429E007B2669 - - fileRef - C1C7B66B1598429E007B2669 - isa - PBXBuildFile - - C1C7B66E1598429E007B2669 - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc - path - main.m - sourceTree - <group> - - C1C7B66F1598429E007B2669 - - fileRef - C1C7B66E1598429E007B2669 - isa - PBXBuildFile - - C1C7B6701598429E007B2669 - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.h - path - GKImagePicker-Prefix.pch - sourceTree - <group> - - C1C7B6711598429E007B2669 - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.h - path - AppDelegate.h - sourceTree - <group> - - C1C7B6721598429E007B2669 - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc - path - AppDelegate.m - sourceTree - <group> - - C1C7B6731598429E007B2669 - - fileRef - C1C7B6721598429E007B2669 - isa - PBXBuildFile - - C1C7B6771598429E007B2669 - - children - - C1C7B6781598429E007B2669 - - isa - PBXVariantGroup - name - ViewController_iPhone.xib - sourceTree - <group> - - C1C7B6781598429E007B2669 - - isa - PBXFileReference - lastKnownFileType - file.xib - name - en - path - en.lproj/ViewController_iPhone.xib - sourceTree - <group> - - C1C7B6791598429E007B2669 - - fileRef - C1C7B6771598429E007B2669 - isa - PBXBuildFile - - C1C7B67A1598429E007B2669 - - children - - C1C7B67B1598429E007B2669 - - isa - PBXVariantGroup - name - ViewController_iPad.xib - sourceTree - <group> - - C1C7B67B1598429E007B2669 - - isa - PBXFileReference - lastKnownFileType - file.xib - name - en - path - en.lproj/ViewController_iPad.xib - sourceTree - <group> - - C1C7B67C1598429E007B2669 - - fileRef - C1C7B67A1598429E007B2669 - isa - PBXBuildFile - - C1C7B67D1598429E007B2669 - - buildSettings - - ALWAYS_SEARCH_USER_PATHS - NO - CLANG_CXX_LANGUAGE_STANDARD - gnu++0x - CLANG_ENABLE_OBJC_ARC - YES - CLANG_WARN__DUPLICATE_METHOD_MATCH - YES - CODE_SIGN_IDENTITY[sdk=iphoneos*] - iPhone Developer - COPY_PHASE_STRIP - NO - GCC_C_LANGUAGE_STANDARD - gnu99 - GCC_DYNAMIC_NO_PIC - NO - GCC_OPTIMIZATION_LEVEL - 0 - GCC_PREPROCESSOR_DEFINITIONS - - DEBUG=1 - $(inherited) - - GCC_SYMBOLS_PRIVATE_EXTERN - NO - GCC_WARN_ABOUT_RETURN_TYPE - YES - GCC_WARN_UNINITIALIZED_AUTOS - YES - GCC_WARN_UNUSED_VARIABLE - YES - IPHONEOS_DEPLOYMENT_TARGET - 6.0 - SDKROOT - iphoneos - TARGETED_DEVICE_FAMILY - 1,2 - - isa - XCBuildConfiguration - name - Debug - - C1C7B67E1598429E007B2669 - - buildSettings - - ALWAYS_SEARCH_USER_PATHS - NO - CLANG_CXX_LANGUAGE_STANDARD - gnu++0x - CLANG_ENABLE_OBJC_ARC - YES - CLANG_WARN__DUPLICATE_METHOD_MATCH - YES - CODE_SIGN_IDENTITY[sdk=iphoneos*] - iPhone Developer - COPY_PHASE_STRIP - YES - GCC_C_LANGUAGE_STANDARD - gnu99 - GCC_WARN_ABOUT_RETURN_TYPE - YES - GCC_WARN_UNINITIALIZED_AUTOS - YES - GCC_WARN_UNUSED_VARIABLE - YES - IPHONEOS_DEPLOYMENT_TARGET - 6.0 - OTHER_CFLAGS - -DNS_BLOCK_ASSERTIONS=1 - SDKROOT - iphoneos - TARGETED_DEVICE_FAMILY - 1,2 - VALIDATE_PRODUCT - YES - - isa - XCBuildConfiguration - name - Release - - C1C7B67F1598429E007B2669 - - buildConfigurations - - C1C7B6801598429E007B2669 - C1C7B6811598429E007B2669 - - defaultConfigurationIsVisible - 0 - defaultConfigurationName - Release - isa - XCConfigurationList - - C1C7B6801598429E007B2669 - - buildSettings - - GCC_PRECOMPILE_PREFIX_HEADER - YES - GCC_PREFIX_HEADER - GKImagePicker/GKImagePicker-Prefix.pch - INFOPLIST_FILE - GKImagePicker/GKImagePicker-Info.plist - IPHONEOS_DEPLOYMENT_TARGET - 5.0 - LIBRARY_SEARCH_PATHS - - $(inherited) - $(FRANK_LIBRARY_SEARCH_PATHS) - - OTHER_LDFLAGS - - $(inherited) - $(FRANK_LDFLAGS) - - PRODUCT_NAME - $(TARGET_NAME) - WRAPPER_EXTENSION - app - - isa - XCBuildConfiguration - name - Debug - - C1C7B6811598429E007B2669 - - buildSettings - - GCC_PRECOMPILE_PREFIX_HEADER - YES - GCC_PREFIX_HEADER - GKImagePicker/GKImagePicker-Prefix.pch - INFOPLIST_FILE - GKImagePicker/GKImagePicker-Info.plist - IPHONEOS_DEPLOYMENT_TARGET - 5.0 - PRODUCT_NAME - $(TARGET_NAME) - WRAPPER_EXTENSION - app - - isa - XCBuildConfiguration - name - Release - - C1C7B6C6159842EA007B2669 - - children - - C1C7B6CF15984306007B2669 - C1C7B6C7159842F9007B2669 - C1C7B6C8159842F9007B2669 - C1C7B6C9159842F9007B2669 - C1C7B6CA159842F9007B2669 - C1C7B6CB159842F9007B2669 - C1C7B6CC159842F9007B2669 - C1C7B6CD159842F9007B2669 - C1C7B6CE159842F9007B2669 - D696F4F816111C28007802E6 - D696F4F916111C28007802E6 - D6862A9016111C68005A5C5C - D6862A9116111C68005A5C5C - - isa - PBXGroup - name - Classes - sourceTree - <group> - - C1C7B6C7159842F9007B2669 - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.h - name - GKImagePicker.h - path - ../GKClasses/GKImagePicker.h - sourceTree - <group> - - C1C7B6C8159842F9007B2669 - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc - name - GKImagePicker.m - path - ../GKClasses/GKImagePicker.m - sourceTree - <group> - - C1C7B6C9159842F9007B2669 - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.h - name - GKImageCropViewController.h - path - ../GKClasses/GKImageCropViewController.h - sourceTree - <group> - - C1C7B6CA159842F9007B2669 - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc - name - GKImageCropViewController.m - path - ../GKClasses/GKImageCropViewController.m - sourceTree - <group> - - C1C7B6CB159842F9007B2669 - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.h - name - GKImageCropView.h - path - ../GKClasses/GKImageCropView.h - sourceTree - <group> - - C1C7B6CC159842F9007B2669 - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc - name - GKImageCropView.m - path - ../GKClasses/GKImageCropView.m - sourceTree - <group> - - C1C7B6CD159842F9007B2669 - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.h - name - GKImageCropOverlayView.h - path - ../GKClasses/GKImageCropOverlayView.h - sourceTree - <group> - - C1C7B6CE159842F9007B2669 - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc - name - GKImageCropOverlayView.m - path - ../GKClasses/GKImageCropOverlayView.m - sourceTree - <group> - - C1C7B6CF15984306007B2669 - - children - - C1C7B6D015984313007B2669 - C1C7B6D115984313007B2669 - C1C7B6D215984313007B2669 - C1C7B6D315984313007B2669 - C1C7B6D415984313007B2669 - C1C7B6D515984313007B2669 - C1C7B6D615984313007B2669 - C1C7B6D715984313007B2669 - - isa - PBXGroup - name - Images - sourceTree - <group> - - C1C7B6D015984313007B2669 - - isa - PBXFileReference - lastKnownFileType - image.png - name - PLCameraSheetButton@2x.png - path - ../GKImages/PLCameraSheetButton@2x.png - sourceTree - <group> - - C1C7B6D115984313007B2669 - - isa - PBXFileReference - lastKnownFileType - image.png - name - PLCameraSheetButtonPressed@2x.png - path - ../GKImages/PLCameraSheetButtonPressed@2x.png - sourceTree - <group> - - C1C7B6D215984313007B2669 - - isa - PBXFileReference - lastKnownFileType - image.png - name - PLCameraSheetDoneButton@2x.png - path - ../GKImages/PLCameraSheetDoneButton@2x.png - sourceTree - <group> - - C1C7B6D315984313007B2669 - - isa - PBXFileReference - lastKnownFileType - image.png - name - PLCameraSheetDoneButtonPressed@2x.png - path - ../GKImages/PLCameraSheetDoneButtonPressed@2x.png - sourceTree - <group> - - C1C7B6D415984313007B2669 - - isa - PBXFileReference - lastKnownFileType - image.png - name - PLCameraSheetButton.png - path - ../GKImages/PLCameraSheetButton.png - sourceTree - <group> - - C1C7B6D515984313007B2669 - - isa - PBXFileReference - lastKnownFileType - image.png - name - PLCameraSheetButtonPressed.png - path - ../GKImages/PLCameraSheetButtonPressed.png - sourceTree - <group> - - C1C7B6D615984313007B2669 - - isa - PBXFileReference - lastKnownFileType - image.png - name - PLCameraSheetDoneButton.png - path - ../GKImages/PLCameraSheetDoneButton.png - sourceTree - <group> - - C1C7B6D715984313007B2669 - - isa - PBXFileReference - lastKnownFileType - image.png - name - PLCameraSheetDoneButtonPressed.png - path - ../GKImages/PLCameraSheetDoneButtonPressed.png - sourceTree - <group> - - C1C7B6D815984313007B2669 - - fileRef - C1C7B6D015984313007B2669 - isa - PBXBuildFile - - C1C7B6D915984313007B2669 - - fileRef - C1C7B6D115984313007B2669 - isa - PBXBuildFile - - C1C7B6DA15984313007B2669 - - fileRef - C1C7B6D215984313007B2669 - isa - PBXBuildFile - - C1C7B6DB15984313007B2669 - - fileRef - C1C7B6D315984313007B2669 - isa - PBXBuildFile - - C1C7B6DC15984313007B2669 - - fileRef - C1C7B6D415984313007B2669 - isa - PBXBuildFile - - C1C7B6DD15984313007B2669 - - fileRef - C1C7B6D515984313007B2669 - isa - PBXBuildFile - - C1C7B6DE15984313007B2669 - - fileRef - C1C7B6D615984313007B2669 - isa - PBXBuildFile - - C1C7B6DF15984313007B2669 - - fileRef - C1C7B6D715984313007B2669 - isa - PBXBuildFile - - C1C7B6E015984328007B2669 - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.h - path - ViewController.h - sourceTree - <group> - - C1C7B6E115984328007B2669 - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc - path - ViewController.m - sourceTree - <group> - - C1C7B6E215984338007B2669 - - fileEncoding - 4 - isa - PBXFileReference - lastKnownFileType - text.plist.strings - path - Localizable.strings - sourceTree - <group> - - C1C7B6E315984338007B2669 - - fileRef - C1C7B6E215984338007B2669 - isa - PBXBuildFile - - C1C7B6E41598445C007B2669 - - fileRef - C1C7B6E115984328007B2669 - isa - PBXBuildFile - - C1C7B6E515984465007B2669 - - fileRef - C1C7B6C8159842F9007B2669 - isa - PBXBuildFile - - C1C7B6E615984465007B2669 - - fileRef - C1C7B6CA159842F9007B2669 - isa - PBXBuildFile - - C1C7B6E715984465007B2669 - - fileRef - C1C7B6CC159842F9007B2669 - isa - PBXBuildFile - - C1C7B6E815984465007B2669 - - fileRef - C1C7B6CE159842F9007B2669 - isa - PBXBuildFile - - D6862A9016111C68005A5C5C - - fileEncoding - 4 - isa - PBXFileReference - lastKnownFileType - sourcecode.c.h - name - GKResizeableCropOverlayView.h - path - GKClasses/GKResizeableCropOverlayView.h - sourceTree - SOURCE_ROOT - - D6862A9116111C68005A5C5C - - fileEncoding - 4 - isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc - name - GKResizeableCropOverlayView.m - path - GKClasses/GKResizeableCropOverlayView.m - sourceTree - SOURCE_ROOT - - D6862A9216111C68005A5C5C - - fileRef - D6862A9116111C68005A5C5C - isa - PBXBuildFile - - D696F4F816111C28007802E6 - - fileEncoding - 4 - isa - PBXFileReference - lastKnownFileType - sourcecode.c.h - name - GKCropBorderView.h - path - GKClasses/GKCropBorderView.h - sourceTree - SOURCE_ROOT - - D696F4F916111C28007802E6 - - fileEncoding - 4 - isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc - name - GKCropBorderView.m - path - GKClasses/GKCropBorderView.m - sourceTree - SOURCE_ROOT - - D696F4FA16111C28007802E6 - - fileRef - D696F4F916111C28007802E6 - isa - PBXBuildFile - - - rootObject - C1C7B6551598429E007B2669 - - +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1A4809C2182FC2E0004C40D2 /* red.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 1A4809C1182FC2E0004C40D2 /* red.jpg */; }; + C147FBF61677C12F0035B373 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C147FBF51677C12F0035B373 /* Default-568h@2x.png */; }; + C1C7B6631598429E007B2669 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1C7B6621598429E007B2669 /* UIKit.framework */; }; + C1C7B6651598429E007B2669 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1C7B6641598429E007B2669 /* Foundation.framework */; }; + C1C7B6671598429E007B2669 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1C7B6661598429E007B2669 /* CoreGraphics.framework */; }; + C1C7B66D1598429E007B2669 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C1C7B66B1598429E007B2669 /* InfoPlist.strings */; }; + C1C7B66F1598429E007B2669 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C1C7B66E1598429E007B2669 /* main.m */; }; + C1C7B6731598429E007B2669 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C1C7B6721598429E007B2669 /* AppDelegate.m */; }; + C1C7B6791598429E007B2669 /* ViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = C1C7B6771598429E007B2669 /* ViewController_iPhone.xib */; }; + C1C7B67C1598429E007B2669 /* ViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = C1C7B67A1598429E007B2669 /* ViewController_iPad.xib */; }; + C1C7B6D815984313007B2669 /* PLCameraSheetButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C1C7B6D015984313007B2669 /* PLCameraSheetButton@2x.png */; }; + C1C7B6D915984313007B2669 /* PLCameraSheetButtonPressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C1C7B6D115984313007B2669 /* PLCameraSheetButtonPressed@2x.png */; }; + C1C7B6DA15984313007B2669 /* PLCameraSheetDoneButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C1C7B6D215984313007B2669 /* PLCameraSheetDoneButton@2x.png */; }; + C1C7B6DB15984313007B2669 /* PLCameraSheetDoneButtonPressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C1C7B6D315984313007B2669 /* PLCameraSheetDoneButtonPressed@2x.png */; }; + C1C7B6DC15984313007B2669 /* PLCameraSheetButton.png in Resources */ = {isa = PBXBuildFile; fileRef = C1C7B6D415984313007B2669 /* PLCameraSheetButton.png */; }; + C1C7B6DD15984313007B2669 /* PLCameraSheetButtonPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = C1C7B6D515984313007B2669 /* PLCameraSheetButtonPressed.png */; }; + C1C7B6DE15984313007B2669 /* PLCameraSheetDoneButton.png in Resources */ = {isa = PBXBuildFile; fileRef = C1C7B6D615984313007B2669 /* PLCameraSheetDoneButton.png */; }; + C1C7B6DF15984313007B2669 /* PLCameraSheetDoneButtonPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = C1C7B6D715984313007B2669 /* PLCameraSheetDoneButtonPressed.png */; }; + C1C7B6E315984338007B2669 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = C1C7B6E215984338007B2669 /* Localizable.strings */; }; + C1C7B6E41598445C007B2669 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C1C7B6E115984328007B2669 /* ViewController.m */; }; + C1C7B6E515984465007B2669 /* GKImagePicker.m in Sources */ = {isa = PBXBuildFile; fileRef = C1C7B6C8159842F9007B2669 /* GKImagePicker.m */; }; + C1C7B6E615984465007B2669 /* GKImageCropViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C1C7B6CA159842F9007B2669 /* GKImageCropViewController.m */; }; + C1C7B6E715984465007B2669 /* GKImageCropView.m in Sources */ = {isa = PBXBuildFile; fileRef = C1C7B6CC159842F9007B2669 /* GKImageCropView.m */; }; + C1C7B6E815984465007B2669 /* GKImageCropOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = C1C7B6CE159842F9007B2669 /* GKImageCropOverlayView.m */; }; + D6862A9216111C68005A5C5C /* GKResizeableCropOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = D6862A9116111C68005A5C5C /* GKResizeableCropOverlayView.m */; }; + D696F4FA16111C28007802E6 /* GKCropBorderView.m in Sources */ = {isa = PBXBuildFile; fileRef = D696F4F916111C28007802E6 /* GKCropBorderView.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 1A4809C1182FC2E0004C40D2 /* red.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; name = red.jpg; path = ../../../../../Desktop/red.jpg; sourceTree = ""; }; + C147FBF51677C12F0035B373 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; + C1C7B65E1598429E007B2669 /* GKImagePicker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GKImagePicker.app; sourceTree = BUILT_PRODUCTS_DIR; }; + C1C7B6621598429E007B2669 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + C1C7B6641598429E007B2669 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + C1C7B6661598429E007B2669 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + C1C7B66A1598429E007B2669 /* GKImagePicker-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GKImagePicker-Info.plist"; sourceTree = ""; }; + C1C7B66C1598429E007B2669 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + C1C7B66E1598429E007B2669 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + C1C7B6701598429E007B2669 /* GKImagePicker-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GKImagePicker-Prefix.pch"; sourceTree = ""; }; + C1C7B6711598429E007B2669 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + C1C7B6721598429E007B2669 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + C1C7B6781598429E007B2669 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPhone.xib; sourceTree = ""; }; + C1C7B67B1598429E007B2669 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPad.xib; sourceTree = ""; }; + C1C7B6C7159842F9007B2669 /* GKImagePicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GKImagePicker.h; path = ../GKClasses/GKImagePicker.h; sourceTree = ""; }; + C1C7B6C8159842F9007B2669 /* GKImagePicker.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = GKImagePicker.m; path = ../GKClasses/GKImagePicker.m; sourceTree = ""; }; + C1C7B6C9159842F9007B2669 /* GKImageCropViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GKImageCropViewController.h; path = ../GKClasses/GKImageCropViewController.h; sourceTree = ""; }; + C1C7B6CA159842F9007B2669 /* GKImageCropViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = GKImageCropViewController.m; path = ../GKClasses/GKImageCropViewController.m; sourceTree = ""; }; + C1C7B6CB159842F9007B2669 /* GKImageCropView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GKImageCropView.h; path = ../GKClasses/GKImageCropView.h; sourceTree = ""; }; + C1C7B6CC159842F9007B2669 /* GKImageCropView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = GKImageCropView.m; path = ../GKClasses/GKImageCropView.m; sourceTree = ""; }; + C1C7B6CD159842F9007B2669 /* GKImageCropOverlayView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GKImageCropOverlayView.h; path = ../GKClasses/GKImageCropOverlayView.h; sourceTree = ""; }; + C1C7B6CE159842F9007B2669 /* GKImageCropOverlayView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = GKImageCropOverlayView.m; path = ../GKClasses/GKImageCropOverlayView.m; sourceTree = ""; }; + C1C7B6D015984313007B2669 /* PLCameraSheetButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "PLCameraSheetButton@2x.png"; path = "../GKImages/PLCameraSheetButton@2x.png"; sourceTree = ""; }; + C1C7B6D115984313007B2669 /* PLCameraSheetButtonPressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "PLCameraSheetButtonPressed@2x.png"; path = "../GKImages/PLCameraSheetButtonPressed@2x.png"; sourceTree = ""; }; + C1C7B6D215984313007B2669 /* PLCameraSheetDoneButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "PLCameraSheetDoneButton@2x.png"; path = "../GKImages/PLCameraSheetDoneButton@2x.png"; sourceTree = ""; }; + C1C7B6D315984313007B2669 /* PLCameraSheetDoneButtonPressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "PLCameraSheetDoneButtonPressed@2x.png"; path = "../GKImages/PLCameraSheetDoneButtonPressed@2x.png"; sourceTree = ""; }; + C1C7B6D415984313007B2669 /* PLCameraSheetButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = PLCameraSheetButton.png; path = ../GKImages/PLCameraSheetButton.png; sourceTree = ""; }; + C1C7B6D515984313007B2669 /* PLCameraSheetButtonPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = PLCameraSheetButtonPressed.png; path = ../GKImages/PLCameraSheetButtonPressed.png; sourceTree = ""; }; + C1C7B6D615984313007B2669 /* PLCameraSheetDoneButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = PLCameraSheetDoneButton.png; path = ../GKImages/PLCameraSheetDoneButton.png; sourceTree = ""; }; + C1C7B6D715984313007B2669 /* PLCameraSheetDoneButtonPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = PLCameraSheetDoneButtonPressed.png; path = ../GKImages/PLCameraSheetDoneButtonPressed.png; sourceTree = ""; }; + C1C7B6E015984328007B2669 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + C1C7B6E115984328007B2669 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + C1C7B6E215984338007B2669 /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = ""; }; + D6862A9016111C68005A5C5C /* GKResizeableCropOverlayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GKResizeableCropOverlayView.h; path = GKClasses/GKResizeableCropOverlayView.h; sourceTree = SOURCE_ROOT; }; + D6862A9116111C68005A5C5C /* GKResizeableCropOverlayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GKResizeableCropOverlayView.m; path = GKClasses/GKResizeableCropOverlayView.m; sourceTree = SOURCE_ROOT; }; + D696F4F816111C28007802E6 /* GKCropBorderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GKCropBorderView.h; path = GKClasses/GKCropBorderView.h; sourceTree = SOURCE_ROOT; }; + D696F4F916111C28007802E6 /* GKCropBorderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GKCropBorderView.m; path = GKClasses/GKCropBorderView.m; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + C1C7B65B1598429E007B2669 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C1C7B6631598429E007B2669 /* UIKit.framework in Frameworks */, + C1C7B6651598429E007B2669 /* Foundation.framework in Frameworks */, + C1C7B6671598429E007B2669 /* CoreGraphics.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + C1C7B6531598429E007B2669 = { + isa = PBXGroup; + children = ( + C1C7B6681598429E007B2669 /* GKImagePicker */, + C1C7B6611598429E007B2669 /* Frameworks */, + C1C7B65F1598429E007B2669 /* Products */, + ); + sourceTree = ""; + }; + C1C7B65F1598429E007B2669 /* Products */ = { + isa = PBXGroup; + children = ( + C1C7B65E1598429E007B2669 /* GKImagePicker.app */, + ); + name = Products; + sourceTree = ""; + }; + C1C7B6611598429E007B2669 /* Frameworks */ = { + isa = PBXGroup; + children = ( + C1C7B6621598429E007B2669 /* UIKit.framework */, + C1C7B6641598429E007B2669 /* Foundation.framework */, + C1C7B6661598429E007B2669 /* CoreGraphics.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + C1C7B6681598429E007B2669 /* GKImagePicker */ = { + isa = PBXGroup; + children = ( + C1C7B6C6159842EA007B2669 /* Classes */, + C1C7B6711598429E007B2669 /* AppDelegate.h */, + C1C7B6721598429E007B2669 /* AppDelegate.m */, + C1C7B6E015984328007B2669 /* ViewController.h */, + C1C7B6E115984328007B2669 /* ViewController.m */, + C1C7B6771598429E007B2669 /* ViewController_iPhone.xib */, + C1C7B67A1598429E007B2669 /* ViewController_iPad.xib */, + 1A4809C1182FC2E0004C40D2 /* red.jpg */, + C1C7B6691598429E007B2669 /* Supporting Files */, + ); + path = GKImagePicker; + sourceTree = ""; + }; + C1C7B6691598429E007B2669 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + C147FBF51677C12F0035B373 /* Default-568h@2x.png */, + C1C7B66A1598429E007B2669 /* GKImagePicker-Info.plist */, + C1C7B66B1598429E007B2669 /* InfoPlist.strings */, + C1C7B66E1598429E007B2669 /* main.m */, + C1C7B6701598429E007B2669 /* GKImagePicker-Prefix.pch */, + C1C7B6E215984338007B2669 /* Localizable.strings */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + C1C7B6C6159842EA007B2669 /* Classes */ = { + isa = PBXGroup; + children = ( + C1C7B6CF15984306007B2669 /* Images */, + C1C7B6C7159842F9007B2669 /* GKImagePicker.h */, + C1C7B6C8159842F9007B2669 /* GKImagePicker.m */, + C1C7B6C9159842F9007B2669 /* GKImageCropViewController.h */, + C1C7B6CA159842F9007B2669 /* GKImageCropViewController.m */, + C1C7B6CB159842F9007B2669 /* GKImageCropView.h */, + C1C7B6CC159842F9007B2669 /* GKImageCropView.m */, + C1C7B6CD159842F9007B2669 /* GKImageCropOverlayView.h */, + C1C7B6CE159842F9007B2669 /* GKImageCropOverlayView.m */, + D696F4F816111C28007802E6 /* GKCropBorderView.h */, + D696F4F916111C28007802E6 /* GKCropBorderView.m */, + D6862A9016111C68005A5C5C /* GKResizeableCropOverlayView.h */, + D6862A9116111C68005A5C5C /* GKResizeableCropOverlayView.m */, + ); + name = Classes; + sourceTree = ""; + }; + C1C7B6CF15984306007B2669 /* Images */ = { + isa = PBXGroup; + children = ( + C1C7B6D015984313007B2669 /* PLCameraSheetButton@2x.png */, + C1C7B6D115984313007B2669 /* PLCameraSheetButtonPressed@2x.png */, + C1C7B6D215984313007B2669 /* PLCameraSheetDoneButton@2x.png */, + C1C7B6D315984313007B2669 /* PLCameraSheetDoneButtonPressed@2x.png */, + C1C7B6D415984313007B2669 /* PLCameraSheetButton.png */, + C1C7B6D515984313007B2669 /* PLCameraSheetButtonPressed.png */, + C1C7B6D615984313007B2669 /* PLCameraSheetDoneButton.png */, + C1C7B6D715984313007B2669 /* PLCameraSheetDoneButtonPressed.png */, + ); + name = Images; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + C1C7B65D1598429E007B2669 /* GKImagePicker */ = { + isa = PBXNativeTarget; + buildConfigurationList = C1C7B67F1598429E007B2669 /* Build configuration list for PBXNativeTarget "GKImagePicker" */; + buildPhases = ( + C1C7B65A1598429E007B2669 /* Sources */, + C1C7B65B1598429E007B2669 /* Frameworks */, + C1C7B65C1598429E007B2669 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = GKImagePicker; + productName = GKImagePicker; + productReference = C1C7B65E1598429E007B2669 /* GKImagePicker.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + C1C7B6551598429E007B2669 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0450; + ORGANIZATIONNAME = "Georg Kitz"; + }; + buildConfigurationList = C1C7B6581598429E007B2669 /* Build configuration list for PBXProject "GKImagePicker" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = C1C7B6531598429E007B2669; + productRefGroup = C1C7B65F1598429E007B2669 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + C1C7B65D1598429E007B2669 /* GKImagePicker */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + C1C7B65C1598429E007B2669 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C1C7B66D1598429E007B2669 /* InfoPlist.strings in Resources */, + C1C7B6791598429E007B2669 /* ViewController_iPhone.xib in Resources */, + C1C7B67C1598429E007B2669 /* ViewController_iPad.xib in Resources */, + C1C7B6D815984313007B2669 /* PLCameraSheetButton@2x.png in Resources */, + C1C7B6D915984313007B2669 /* PLCameraSheetButtonPressed@2x.png in Resources */, + C1C7B6DA15984313007B2669 /* PLCameraSheetDoneButton@2x.png in Resources */, + C1C7B6DB15984313007B2669 /* PLCameraSheetDoneButtonPressed@2x.png in Resources */, + C1C7B6DC15984313007B2669 /* PLCameraSheetButton.png in Resources */, + C1C7B6DD15984313007B2669 /* PLCameraSheetButtonPressed.png in Resources */, + C1C7B6DE15984313007B2669 /* PLCameraSheetDoneButton.png in Resources */, + C1C7B6DF15984313007B2669 /* PLCameraSheetDoneButtonPressed.png in Resources */, + 1A4809C2182FC2E0004C40D2 /* red.jpg in Resources */, + C1C7B6E315984338007B2669 /* Localizable.strings in Resources */, + C147FBF61677C12F0035B373 /* Default-568h@2x.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + C1C7B65A1598429E007B2669 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C1C7B6E515984465007B2669 /* GKImagePicker.m in Sources */, + C1C7B6E615984465007B2669 /* GKImageCropViewController.m in Sources */, + C1C7B6E715984465007B2669 /* GKImageCropView.m in Sources */, + C1C7B6E815984465007B2669 /* GKImageCropOverlayView.m in Sources */, + C1C7B6E41598445C007B2669 /* ViewController.m in Sources */, + C1C7B66F1598429E007B2669 /* main.m in Sources */, + C1C7B6731598429E007B2669 /* AppDelegate.m in Sources */, + D696F4FA16111C28007802E6 /* GKCropBorderView.m in Sources */, + D6862A9216111C68005A5C5C /* GKResizeableCropOverlayView.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + C1C7B66B1598429E007B2669 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + C1C7B66C1598429E007B2669 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + C1C7B6771598429E007B2669 /* ViewController_iPhone.xib */ = { + isa = PBXVariantGroup; + children = ( + C1C7B6781598429E007B2669 /* en */, + ); + name = ViewController_iPhone.xib; + sourceTree = ""; + }; + C1C7B67A1598429E007B2669 /* ViewController_iPad.xib */ = { + isa = PBXVariantGroup; + children = ( + C1C7B67B1598429E007B2669 /* en */, + ); + name = ViewController_iPad.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C1C7B67D1598429E007B2669 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + C1C7B67E1598429E007B2669 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + C1C7B6801598429E007B2669 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "GKImagePicker/GKImagePicker-Prefix.pch"; + INFOPLIST_FILE = "GKImagePicker/GKImagePicker-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(FRANK_LIBRARY_SEARCH_PATHS)", + ); + OTHER_LDFLAGS = ( + "$(inherited)", + "$(FRANK_LDFLAGS)", + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + C1C7B6811598429E007B2669 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "GKImagePicker/GKImagePicker-Prefix.pch"; + INFOPLIST_FILE = "GKImagePicker/GKImagePicker-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C1C7B6581598429E007B2669 /* Build configuration list for PBXProject "GKImagePicker" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C1C7B67D1598429E007B2669 /* Debug */, + C1C7B67E1598429E007B2669 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C1C7B67F1598429E007B2669 /* Build configuration list for PBXNativeTarget "GKImagePicker" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C1C7B6801598429E007B2669 /* Debug */, + C1C7B6811598429E007B2669 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = C1C7B6551598429E007B2669 /* Project object */; +} From 2aa7d241fefaf3e359e96d43ad24ee1b9d211cba Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Sun, 10 Nov 2013 22:21:14 +0800 Subject: [PATCH 03/25] Stops taking toolbar height into consideration with cropper, as it is now transparent --- GKClasses/GKImageCropOverlayView.m | 4 +--- GKClasses/GKImageCropView.m | 3 +-- GKClasses/GKResizeableCropOverlayView.m | 17 ++++++----------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/GKClasses/GKImageCropOverlayView.m b/GKClasses/GKImageCropOverlayView.m index bb3e999..c67b722 100644 --- a/GKClasses/GKImageCropOverlayView.m +++ b/GKClasses/GKImageCropOverlayView.m @@ -41,10 +41,8 @@ - (id)initWithFrame:(CGRect)frame{ - (void)drawRect:(CGRect)rect{ - CGFloat toolbarSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 0 : TOOLBAR_HEIGHT; - CGFloat width = CGRectGetWidth(self.frame); - CGFloat height = CGRectGetHeight(self.frame) - toolbarSize; + CGFloat height = CGRectGetHeight(self.frame); CGFloat heightSpan = floor(height / 2 - self.cropSize.height / 2); CGFloat widthSpan = floor(width / 2 - self.cropSize.width / 2); diff --git a/GKClasses/GKImageCropView.m b/GKClasses/GKImageCropView.m index 5c32695..47dd3eb 100644 --- a/GKClasses/GKImageCropView.m +++ b/GKClasses/GKImageCropView.m @@ -229,9 +229,8 @@ - (void)layoutSubviews{ [super layoutSubviews]; CGSize size = self.cropSize; - CGFloat toolbarSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 0 : TOOLBAR_HEIGHT; self.xOffset = floor((CGRectGetWidth(self.bounds) - size.width) * 0.5); - self.yOffset = floor((CGRectGetHeight(self.bounds) - toolbarSize - size.height) * 0.5); //fixed + self.yOffset = floor((CGRectGetHeight(self.bounds) - size.height) * 0.5); //fixed CGFloat height = self.imageToCrop.size.height; CGFloat width = self.imageToCrop.size.width; diff --git a/GKClasses/GKResizeableCropOverlayView.m b/GKClasses/GKResizeableCropOverlayView.m index 3670db7..970e4c4 100644 --- a/GKClasses/GKResizeableCropOverlayView.m +++ b/GKClasses/GKResizeableCropOverlayView.m @@ -42,9 +42,8 @@ @implementation GKResizeableCropOverlayView -(void)setFrame:(CGRect)frame{ [super setFrame:frame]; - CGFloat toolbarSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 0 : TOOLBAR_HEIGHT; - _contentView.frame = CGRectMake(self.bounds.size.width / 2 - _initialContentSize.width / 2 , (self.bounds.size.height - toolbarSize) / 2 - _initialContentSize.height / 2 , _initialContentSize.width, _initialContentSize.height); - _cropBorderView.frame = CGRectMake(self.bounds.size.width / 2 - _initialContentSize.width / 2 - kBorderCorrectionValue, (self.bounds.size.height - toolbarSize) / 2 - _initialContentSize.height / 2 - kBorderCorrectionValue, _initialContentSize.width + kBorderCorrectionValue*2, _initialContentSize.height + kBorderCorrectionValue*2); + _contentView.frame = CGRectMake(self.bounds.size.width / 2 - _initialContentSize.width / 2 , (self.bounds.size.height) / 2 - _initialContentSize.height / 2 , _initialContentSize.width, _initialContentSize.height); + _cropBorderView.frame = CGRectMake(self.bounds.size.width / 2 - _initialContentSize.width / 2 - kBorderCorrectionValue, (self.bounds.size.height) / 2 - _initialContentSize.height / 2 - kBorderCorrectionValue, _initialContentSize.width + kBorderCorrectionValue*2, _initialContentSize.height + kBorderCorrectionValue*2); } @@ -94,15 +93,13 @@ -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ #pragma private -(void)_addContentViews{ - CGFloat toolbarSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 0 : TOOLBAR_HEIGHT; - - _contentView = [[UIView alloc] initWithFrame:CGRectMake(self.bounds.size.width / 2 - _initialContentSize.width / 2 , (self.bounds.size.height - toolbarSize) / 2 - _initialContentSize.height / 2 , _initialContentSize.width, _initialContentSize.height)]; + _contentView = [[UIView alloc] initWithFrame:CGRectMake(self.bounds.size.width / 2 - _initialContentSize.width / 2 , (self.bounds.size.height) / 2 - _initialContentSize.height / 2 , _initialContentSize.width, _initialContentSize.height)]; _contentView.backgroundColor = [UIColor clearColor]; self.cropSize = _contentView.frame.size; [self addSubview:_contentView]; // NSLog(@"x: %f y: %f %f", CGRectGetMinX(_contentView.frame), CGRectGetMinY(_contentView.frame), self.bounds.size.width); - _cropBorderView = [[GKCropBorderView alloc] initWithFrame:CGRectMake(self.bounds.size.width / 2 - _initialContentSize.width / 2 - kBorderCorrectionValue, (self.bounds.size.height - toolbarSize) / 2 - _initialContentSize.height / 2 - kBorderCorrectionValue, _initialContentSize.width + kBorderCorrectionValue*2, _initialContentSize.height + kBorderCorrectionValue*2)]; + _cropBorderView = [[GKCropBorderView alloc] initWithFrame:CGRectMake(self.bounds.size.width / 2 - _initialContentSize.width / 2 - kBorderCorrectionValue, (self.bounds.size.height) / 2 - _initialContentSize.height / 2 - kBorderCorrectionValue, _initialContentSize.width + kBorderCorrectionValue*2, _initialContentSize.height + kBorderCorrectionValue*2)]; [self addSubview:_cropBorderView]; } @@ -179,8 +176,6 @@ -(void)_resizeWithTouchPoint:(CGPoint)point{ } -(CGRect)_preventBorderFrameFromGettingTooSmallOrTooBig:(CGRect)newFrame{ - CGFloat toolbarSize = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 0 : TOOLBAR_HEIGHT; - if (newFrame.size.width < 64) { newFrame.size.width = _cropBorderView.frame.size.width; newFrame.origin.x = _cropBorderView.frame.origin.x; @@ -203,8 +198,8 @@ -(CGRect)_preventBorderFrameFromGettingTooSmallOrTooBig:(CGRect)newFrame{ if (newFrame.size.width + newFrame.origin.x > self.frame.size.width) newFrame.size.width = self.frame.size.width - _cropBorderView.frame.origin.x; - if (newFrame.size.height + newFrame.origin.y > self.frame.size.height - toolbarSize) - newFrame.size.height = self.frame.size.height - _cropBorderView.frame.origin.y - toolbarSize; + if (newFrame.size.height + newFrame.origin.y > self.frame.size.height) + newFrame.size.height = self.frame.size.height - _cropBorderView.frame.origin.y; return newFrame; } From 63bcb2edc65610f90c176efde4932be535eaac0c Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Sun, 10 Nov 2013 22:29:32 +0800 Subject: [PATCH 04/25] Makes the border of the cropper a bit simpler and more explicit --- GKClasses/GKImageCropOverlayView.m | 7 ++++--- GKImagePicker/ViewController.m | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/GKClasses/GKImageCropOverlayView.m b/GKClasses/GKImageCropOverlayView.m index c67b722..058cb8c 100644 --- a/GKClasses/GKImageCropOverlayView.m +++ b/GKClasses/GKImageCropOverlayView.m @@ -49,15 +49,16 @@ - (void)drawRect:(CGRect)rect{ //fill outer rect [[UIColor colorWithRed:0. green:0. blue:0. alpha:0.5] set]; - UIRectFill(self.bounds); +// UIRectFill(self.bounds); //fill inner border [[UIColor colorWithRed:1. green:1. blue:1. alpha:0.5] set]; - UIRectFrame(CGRectMake(widthSpan - 2, heightSpan - 2, self.cropSize.width + 4, self.cropSize.height + 4)); +// UIRectFrame(CGRectMake(widthSpan - 2, heightSpan - 2, self.cropSize.width + 4, self.cropSize.height + 4)); + UIRectFrame(CGRectMake(widthSpan, heightSpan, self.cropSize.width, self.cropSize.height)); //fill inner rect [[UIColor clearColor] set]; - UIRectFill(CGRectMake(widthSpan, heightSpan, self.cropSize.width, self.cropSize.height)); + UIRectFill(CGRectMake(widthSpan + 2, heightSpan + 2, self.cropSize.width - 4, self.cropSize.height - 4)); diff --git a/GKImagePicker/ViewController.m b/GKImagePicker/ViewController.m index 91cebdc..1f03854 100644 --- a/GKImagePicker/ViewController.m +++ b/GKImagePicker/ViewController.m @@ -8,7 +8,7 @@ #import "ViewController.h" #import "GKImagePicker.h" - + @interface ViewController () @property (nonatomic, strong) GKImagePicker *imagePicker; @property (nonatomic, strong) UIPopoverController *popoverController; From a1364fc02f27a02a692d38b401d81fa68ac898cb Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Mon, 11 Nov 2013 08:32:26 +0800 Subject: [PATCH 05/25] Modifies placement of imageView on scrollView so that there never are empty spaces around the cropped image. Initially places image centered in crop rect. Fixes placement and cropping code by simplifying it. --- GKClasses/GKImageCropView.m | 45 +++++++++++-------------- GKClasses/GKImagePicker.m | 1 + GKImagePicker.xcodeproj/project.pbxproj | 4 --- GKImagePicker/ViewController.m | 3 +- 4 files changed, 23 insertions(+), 30 deletions(-) diff --git a/GKClasses/GKImageCropView.m b/GKClasses/GKImageCropView.m index 47dd3eb..9093adf 100644 --- a/GKClasses/GKImageCropView.m +++ b/GKClasses/GKImageCropView.m @@ -45,6 +45,7 @@ - (void)layoutSubviews{ frameToCenter.origin.y = 0; zoomView.frame = frameToCenter; +// zoomView.frame = CGRectMake(0, 0, 200, 200); } @end @@ -131,15 +132,8 @@ -(CGRect)_calcVisibleRectForCropArea{ CGFloat scaleHeight = self.imageToCrop.size.height / self.cropSize.height; CGFloat scale = 0.0f; - if (self.cropSize.width > self.cropSize.height) { - scale = (self.imageToCrop.size.width < self.imageToCrop.size.height ? - MAX(scaleWidth, scaleHeight) : - MIN(scaleWidth, scaleHeight)); - }else{ - scale = (self.imageToCrop.size.width < self.imageToCrop.size.height ? - MIN(scaleWidth, scaleHeight) : - MAX(scaleWidth, scaleHeight)); - } + scale = MIN(scaleWidth, scaleHeight); + //extract visible rect from scrollview and scale it CGRect visibleRect = [scrollView convertRect:scrollView.bounds toView:imageView]; return visibleRect = GKScaleRect(visibleRect, scale); @@ -235,27 +229,28 @@ - (void)layoutSubviews{ CGFloat height = self.imageToCrop.size.height; CGFloat width = self.imageToCrop.size.width; - CGFloat faktor = 0.f; - CGFloat faktoredHeight = 0.f; - CGFloat faktoredWidth = 0.f; + CGFloat factor = 0.f, widthFactor = 0.f, heightFactor = 0.f; + CGFloat factoredHeight = 0.f; + CGFloat factoredWidth = 0.f; - if(width > height){ - - faktor = width / size.width; - faktoredWidth = size.width; - faktoredHeight = height / faktor; - - } else { - - faktor = height / size.height; - faktoredWidth = width / faktor; - faktoredHeight = size.height; - } + widthFactor = width / size.width; + heightFactor = height / size.height; + factor = MIN(widthFactor, heightFactor); + factoredWidth = width / factor; + factoredHeight = height / factor; self.cropOverlayView.frame = self.bounds; self.scrollView.frame = CGRectMake(xOffset, yOffset, size.width, size.height); self.scrollView.contentSize = CGSizeMake(size.width, size.height); - self.imageView.frame = CGRectMake(0, floor((size.height - faktoredHeight) * 0.5), faktoredWidth, faktoredHeight); + self.imageView.frame = CGRectMake(0, floor((size.height - factoredHeight) * 0.5), factoredWidth, factoredHeight); + + /* TODO + implement a feature that allows restricting the zoom scale to the max available + (based on image's resolution), to prevent pixelation. We simply have to deteremine the + max zoom scale and place it here + */ + [self.scrollView setContentOffset:CGPointMake((factoredWidth - size.width) * 0.5, (factoredHeight - size.height) * 0.5)]; + [self.scrollView setZoomScale:1.0]; } #pragma mark - diff --git a/GKClasses/GKImagePicker.m b/GKClasses/GKImagePicker.m index 5793f49..3316b10 100644 --- a/GKClasses/GKImagePicker.m +++ b/GKClasses/GKImagePicker.m @@ -7,6 +7,7 @@ // #import "GKImagePicker.h" + #import "GKImageCropViewController.h" @interface GKImagePicker () diff --git a/GKImagePicker.xcodeproj/project.pbxproj b/GKImagePicker.xcodeproj/project.pbxproj index 8fb8672..87234b0 100644 --- a/GKImagePicker.xcodeproj/project.pbxproj +++ b/GKImagePicker.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 1A4809C2182FC2E0004C40D2 /* red.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 1A4809C1182FC2E0004C40D2 /* red.jpg */; }; C147FBF61677C12F0035B373 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C147FBF51677C12F0035B373 /* Default-568h@2x.png */; }; C1C7B6631598429E007B2669 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1C7B6621598429E007B2669 /* UIKit.framework */; }; C1C7B6651598429E007B2669 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1C7B6641598429E007B2669 /* Foundation.framework */; }; @@ -36,7 +35,6 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 1A4809C1182FC2E0004C40D2 /* red.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; name = red.jpg; path = ../../../../../Desktop/red.jpg; sourceTree = ""; }; C147FBF51677C12F0035B373 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; C1C7B65E1598429E007B2669 /* GKImagePicker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GKImagePicker.app; sourceTree = BUILT_PRODUCTS_DIR; }; C1C7B6621598429E007B2669 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; @@ -126,7 +124,6 @@ C1C7B6E115984328007B2669 /* ViewController.m */, C1C7B6771598429E007B2669 /* ViewController_iPhone.xib */, C1C7B67A1598429E007B2669 /* ViewController_iPad.xib */, - 1A4809C1182FC2E0004C40D2 /* red.jpg */, C1C7B6691598429E007B2669 /* Supporting Files */, ); path = GKImagePicker; @@ -242,7 +239,6 @@ C1C7B6DD15984313007B2669 /* PLCameraSheetButtonPressed.png in Resources */, C1C7B6DE15984313007B2669 /* PLCameraSheetDoneButton.png in Resources */, C1C7B6DF15984313007B2669 /* PLCameraSheetDoneButtonPressed.png in Resources */, - 1A4809C2182FC2E0004C40D2 /* red.jpg in Resources */, C1C7B6E315984338007B2669 /* Localizable.strings in Resources */, C147FBF61677C12F0035B373 /* Default-568h@2x.png in Resources */, ); diff --git a/GKImagePicker/ViewController.m b/GKImagePicker/ViewController.m index 1f03854..7b045ae 100644 --- a/GKImagePicker/ViewController.m +++ b/GKImagePicker/ViewController.m @@ -8,7 +8,7 @@ #import "ViewController.h" #import "GKImagePicker.h" - + @interface ViewController () @property (nonatomic, strong) GKImagePicker *imagePicker; @property (nonatomic, strong) UIPopoverController *popoverController; @@ -18,6 +18,7 @@ @interface ViewController () Date: Mon, 11 Nov 2013 10:51:20 +0800 Subject: [PATCH 06/25] Includes an action sheet for choosing between the camera or photo library, and adds more independent support for the iPad as well (without having a reference to the PopoverController). --- GKClasses/GKImagePicker.h | 3 +- GKClasses/GKImagePicker.m | 108 +++++++++++++++--- GKImagePicker/Localizable.strings | 5 +- GKImagePicker/ViewController.m | 37 +----- .../en.lproj/ViewController_iPhone.xib | 40 +++---- 5 files changed, 121 insertions(+), 72 deletions(-) diff --git a/GKClasses/GKImagePicker.h b/GKClasses/GKImagePicker.h index a8fa789..2497bd1 100644 --- a/GKClasses/GKImagePicker.h +++ b/GKClasses/GKImagePicker.h @@ -14,9 +14,10 @@ @property (nonatomic, weak) id delegate; @property (nonatomic, assign) CGSize cropSize; //default value is 320x320 (which is exactly the same as the normal imagepicker uses) -@property (nonatomic, strong, readonly) UIImagePickerController *imagePickerController; @property (nonatomic, assign) BOOL resizeableCropArea; +- (void)showActionSheetOnViewController:(UIViewController *)viewController onPopoverFromView:(UIView *)popoverView; + @end diff --git a/GKClasses/GKImagePicker.m b/GKClasses/GKImagePicker.m index 3316b10..efc8b4f 100644 --- a/GKClasses/GKImagePicker.m +++ b/GKClasses/GKImagePicker.m @@ -10,8 +10,11 @@ #import "GKImageCropViewController.h" -@interface GKImagePicker () -@property (nonatomic, strong, readwrite) UIImagePickerController *imagePickerController; +@interface GKImagePicker () +@property (nonatomic, weak) UIViewController *presentingViewController; +@property (nonatomic, weak) UIView *popoverView; +@property (nonatomic, strong) UIPopoverController *popoverController; +@property (nonatomic, strong) UIImagePickerController *imagePickerController; - (void)_hideController; @end @@ -21,8 +24,6 @@ @implementation GKImagePicker #pragma mark Getter/Setter @synthesize cropSize, delegate, resizeableCropArea; -@synthesize imagePickerController = _imagePickerController; - #pragma mark - #pragma mark Init Methods @@ -32,9 +33,6 @@ - (id)init{ self.cropSize = CGSizeMake(320, 320); self.resizeableCropArea = NO; - _imagePickerController = [[UIImagePickerController alloc] init]; - _imagePickerController.delegate = self; - _imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; } return self; } @@ -43,13 +41,12 @@ - (id)init{ # pragma mark Private Methods - (void)_hideController{ - - if (![_imagePickerController.presentedViewController isKindOfClass:[UIPopoverController class]]){ - + if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM()) { + [self.popoverController dismissPopoverAnimated:YES]; + } else { [self.imagePickerController dismissViewControllerAnimated:YES completion:nil]; - - } - + } + } #pragma mark - @@ -87,7 +84,90 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking - (void)imageCropController:(GKImageCropViewController *)imageCropController didFinishWithCroppedImage:(UIImage *)croppedImage{ if ([self.delegate respondsToSelector:@selector(imagePicker:pickedImage:)]) { - [self.delegate imagePicker:self pickedImage:croppedImage]; + [self _hideController]; + [self.delegate imagePicker:self pickedImage:croppedImage]; + } +} + + +#pragma mark - +#pragma mark - Action Sheet and Image Pickers + +- (void)showActionSheetOnViewController:(UIViewController *)viewController onPopoverFromView:(UIView *)popoverView +{ + self.presentingViewController = viewController; + self.popoverView = popoverView; + + UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil + delegate:(id)self + cancelButtonTitle:NSLocalizedString(@"GKIcancel", @"") + destructiveButtonTitle:nil + otherButtonTitles:NSLocalizedString(@"GKIfromCamera", @""), NSLocalizedString(@"GKIfromLibrary", @""), nil]; + actionSheet.delegate = self; + + if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM()) { + [actionSheet showFromRect:self.popoverView.frame inView:self.presentingViewController.view animated:YES]; + } else { + [actionSheet showInView:self.presentingViewController.view]; + } +} + +- (void)presentImagePickerController +{ + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { + + self.popoverController = [[UIPopoverController alloc] initWithContentViewController:self.imagePickerController]; + [self.popoverController presentPopoverFromRect:self.popoverView.frame + inView:self.presentingViewController.view + permittedArrowDirections:UIPopoverArrowDirectionAny + animated:YES]; + + } else { + + [self.presentingViewController presentModalViewController:self.imagePickerController animated:YES]; + + } +} + +- (void)showCameraImagePicker { + +#if TARGET_IPHONE_SIMULATOR + + UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Simulator" message:@"Camera not available." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; + [alert show]; + +#elif TARGET_OS_IPHONE + + self.imagePickerController = [[UIImagePickerController alloc] init]; + self.imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera; + self.imagePickerController.delegate = self; + self.imagePickerController.allowsEditing = NO; + + [self presentImagePickerController]; +#endif + +} + +- (void)showGalleryImagePicker { + self.imagePickerController = [[UIImagePickerController alloc] init]; + self.imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; + self.imagePickerController.delegate = self; + self.imagePickerController.allowsEditing = NO; + + [self presentImagePickerController]; +} + +#pragma mark - +#pragma mark - UIActionSheetDelegate + +- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { + switch (buttonIndex) { + case 0: + [self showCameraImagePicker]; + break; + case 1: + [self showGalleryImagePicker]; + break; } } diff --git a/GKImagePicker/Localizable.strings b/GKImagePicker/Localizable.strings index 0af72f8..ccce66b 100644 --- a/GKImagePicker/Localizable.strings +++ b/GKImagePicker/Localizable.strings @@ -10,4 +10,7 @@ "GKIuse" = "Use"; "GKImoveAndScale" = "Move and Scale"; "GKIcancel" = "Cancel"; -"GKIuse" = "Choose"; \ No newline at end of file +"GKIuse" = "Choose"; + +"GKIfromCamera" = "Image from Camera"; +"GKIfromLibrary" = "Image from Library"; \ No newline at end of file diff --git a/GKImagePicker/ViewController.m b/GKImagePicker/ViewController.m index 7b045ae..8066fd9 100644 --- a/GKImagePicker/ViewController.m +++ b/GKImagePicker/ViewController.m @@ -35,16 +35,7 @@ - (void)showPicker:(UIButton *)btn{ self.imagePicker.cropSize = CGSizeMake(280, 280); self.imagePicker.delegate = self; - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { - - self.popoverController = [[UIPopoverController alloc] initWithContentViewController:self.imagePicker.imagePickerController]; - [self.popoverController presentPopoverFromRect:btn.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; - - } else { - - [self presentModalViewController:self.imagePicker.imagePickerController animated:YES]; - - } + [self.imagePicker showActionSheetOnViewController:self onPopoverFromView:btn]; } - (void)showNormalPicker:(UIButton *)btn{ @@ -71,17 +62,8 @@ -(void)showResizablePicker:(UIButton*)btn{ self.imagePicker.cropSize = CGSizeMake(296, 300); self.imagePicker.delegate = self; self.imagePicker.resizeableCropArea = YES; - - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { - - self.popoverController = [[UIPopoverController alloc] initWithContentViewController:self.imagePicker.imagePickerController]; - [self.popoverController presentPopoverFromRect:btn.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; - - } else { - - [self presentModalViewController:self.imagePicker.imagePickerController animated:YES]; - - } + + [self.imagePicker showActionSheetOnViewController:self onPopoverFromView:btn]; } - (void)viewDidLoad @@ -152,19 +134,6 @@ - (void)viewWillLayoutSubviews{ - (void)imagePicker:(GKImagePicker *)imagePicker pickedImage:(UIImage *)image{ self.imgView.image = image; - [self hideImagePicker]; -} - -- (void)hideImagePicker{ - if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM()) { - - [self.popoverController dismissPopoverAnimated:YES]; - - } else { - - [self.imagePicker.imagePickerController dismissViewControllerAnimated:YES completion:nil]; - - } } # pragma mark - diff --git a/GKImagePicker/en.lproj/ViewController_iPhone.xib b/GKImagePicker/en.lproj/ViewController_iPhone.xib index 9787e54..9747132 100644 --- a/GKImagePicker/en.lproj/ViewController_iPhone.xib +++ b/GKImagePicker/en.lproj/ViewController_iPhone.xib @@ -1,14 +1,14 @@ - 1536 - 12A206j - 2519 - 1172.1 - 613.00 + 1280 + 13A603 + 4514 + 1265 + 695.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 1856 + 3746 IBProxyObject @@ -31,11 +31,9 @@ IBCocoaTouchFramework - + 274 {{0, 20}, {320, 460}} - - 3 MC43NQA @@ -98,23 +96,21 @@ 7 - - - - ViewController - UIViewController - - IBProjectSource - ./Classes/ViewController.h - - - - + 0 IBCocoaTouchFramework + YES + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + YES 3 YES - 1856 + 3746 From 7d6ac41c152a526d35c889f1434180503f20d5d0 Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Mon, 11 Nov 2013 11:18:49 +0800 Subject: [PATCH 07/25] Replaces deprecated call to presentModalViewController --- GKClasses/GKImagePicker.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GKClasses/GKImagePicker.m b/GKClasses/GKImagePicker.m index efc8b4f..c17b7fc 100644 --- a/GKClasses/GKImagePicker.m +++ b/GKClasses/GKImagePicker.m @@ -124,7 +124,7 @@ - (void)presentImagePickerController } else { - [self.presentingViewController presentModalViewController:self.imagePickerController animated:YES]; + [self.presentingViewController presentViewController:self.imagePickerController animated:YES completion:nil]; } } From 01b766a44057a083e50fabd870fb2c76bf7fdc4d Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Wed, 13 Nov 2013 07:53:43 +0800 Subject: [PATCH 08/25] Show and Hide status bar when displaying the cropping view controller --- GKClasses/GKImageCropViewController.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/GKClasses/GKImageCropViewController.m b/GKClasses/GKImageCropViewController.m index 42d9b84..dcd0161 100644 --- a/GKClasses/GKImageCropViewController.m +++ b/GKClasses/GKImageCropViewController.m @@ -51,8 +51,8 @@ - (void)_actionUse{ - (void)_setupNavigationBar{ - - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel + + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(_actionCancel)]; @@ -150,6 +150,7 @@ - (void)viewDidLoad{ // Do any additional setup after loading the view. self.title = NSLocalizedString(@"GKIchoosePhoto", @""); + [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; [self _setupNavigationBar]; [self _setupCropView]; @@ -167,6 +168,12 @@ - (void)viewDidUnload{ // Release any retained subviews of the main view. } +- (void)viewWillDisappear:(BOOL)animated +{ + [super viewWillDisappear:animated]; + [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; +} + - (void)viewWillLayoutSubviews{ [super viewWillLayoutSubviews]; From 9380327aef4f6b19493a1e4c2ad7589a653fcf5a Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Wed, 13 Nov 2013 20:21:26 +0800 Subject: [PATCH 09/25] =?UTF-8?q?Normalizes=20crop=20sizes=20that=20may=20?= =?UTF-8?q?bleed=20out=20of=20the=20edges=20of=20the=20screen=20or=20even?= =?UTF-8?q?=20into=20the=20toolbar,=20along=20with=20a=20padding=20to=20be?= =?UTF-8?q?=20able=20to=20see=20the=20crop=20rect.=20This=20doesn=E2=80=99?= =?UTF-8?q?t=20affect=20the=20size=20of=20the=20returned=20image.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GKClasses/GKImageCropView.h | 3 ++- GKClasses/GKImageCropViewController.m | 20 +++++++++++++++++++- GKImagePicker.xcodeproj/project.pbxproj | 3 ++- GKImagePicker/ViewController.m | 3 ++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/GKClasses/GKImageCropView.h b/GKClasses/GKImageCropView.h index 14c2349..6621212 100644 --- a/GKClasses/GKImageCropView.h +++ b/GKClasses/GKImageCropView.h @@ -8,7 +8,8 @@ #import -#define TOOLBAR_HEIGHT 72.f +#define TOOLBAR_HEIGHT 72.f +#define TOOLBAR_PADDING 10.f @interface GKImageCropView : UIView diff --git a/GKClasses/GKImageCropViewController.m b/GKClasses/GKImageCropViewController.m index dcd0161..5df4da8 100644 --- a/GKClasses/GKImageCropViewController.m +++ b/GKClasses/GKImageCropViewController.m @@ -63,12 +63,30 @@ - (void)_setupNavigationBar{ } +#pragma mark - +#pragma mark - Crop Rect Normalizing + +- (CGSize)normalizedCropSizeForRect:(CGRect)rect +{ + CGSize normalizedSize; + CGSize maxSize = CGSizeMake(rect.size.width - (2 * TOOLBAR_PADDING), + rect.size.height - (2. * (TOOLBAR_HEIGHT + TOOLBAR_PADDING))); + if (self.cropSize.height / self.cropSize.width > maxSize.height / maxSize.width) { + normalizedSize = CGSizeMake(self.cropSize.width * maxSize.height / self.cropSize.height, + maxSize.height); + } else { + normalizedSize = CGSizeMake(maxSize.width, + self.cropSize.height * maxSize.width / self.cropSize.width); + } + return normalizedSize; +} + - (void)_setupCropView{ self.imageCropView = [[GKImageCropView alloc] initWithFrame:self.view.bounds]; [self.imageCropView setImageToCrop:sourceImage]; [self.imageCropView setResizableCropArea:self.resizeableCropArea]; - [self.imageCropView setCropSize:cropSize]; + [self.imageCropView setCropSize:[self normalizedCropSizeForRect:self.view.bounds]]; [self.view addSubview:self.imageCropView]; } diff --git a/GKImagePicker.xcodeproj/project.pbxproj b/GKImagePicker.xcodeproj/project.pbxproj index 87234b0..05a4561 100644 --- a/GKImagePicker.xcodeproj/project.pbxproj +++ b/GKImagePicker.xcodeproj/project.pbxproj @@ -203,7 +203,7 @@ C1C7B6551598429E007B2669 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0450; + LastUpgradeCheck = 0500; ORGANIZATIONNAME = "Georg Kitz"; }; buildConfigurationList = C1C7B6581598429E007B2669 /* Build configuration list for PBXProject "GKImagePicker" */; @@ -314,6 +314,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 6.0; + ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/GKImagePicker/ViewController.m b/GKImagePicker/ViewController.m index 8066fd9..0bf35a7 100644 --- a/GKImagePicker/ViewController.m +++ b/GKImagePicker/ViewController.m @@ -29,10 +29,11 @@ @implementation ViewController @synthesize ctr; @synthesize customCropButton, normalCropButton, resizableButton; + - (void)showPicker:(UIButton *)btn{ self.imagePicker = [[GKImagePicker alloc] init]; - self.imagePicker.cropSize = CGSizeMake(280, 280); + self.imagePicker.cropSize = CGSizeMake(320, 496); self.imagePicker.delegate = self; [self.imagePicker showActionSheetOnViewController:self onPopoverFromView:btn]; From 0b968b80d57b2bd9ead84e83144ef13df1c16bf8 Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Wed, 13 Nov 2013 20:26:44 +0800 Subject: [PATCH 10/25] Brings back the transparent gray fill outside of the crop rect --- GKClasses/GKImageCropOverlayView.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/GKClasses/GKImageCropOverlayView.m b/GKClasses/GKImageCropOverlayView.m index 058cb8c..0f693f2 100644 --- a/GKClasses/GKImageCropOverlayView.m +++ b/GKClasses/GKImageCropOverlayView.m @@ -49,7 +49,7 @@ - (void)drawRect:(CGRect)rect{ //fill outer rect [[UIColor colorWithRed:0. green:0. blue:0. alpha:0.5] set]; -// UIRectFill(self.bounds); + UIRectFill(self.bounds); //fill inner border [[UIColor colorWithRed:1. green:1. blue:1. alpha:0.5] set]; @@ -58,7 +58,8 @@ - (void)drawRect:(CGRect)rect{ //fill inner rect [[UIColor clearColor] set]; - UIRectFill(CGRectMake(widthSpan + 2, heightSpan + 2, self.cropSize.width - 4, self.cropSize.height - 4)); +// UIRectFill(CGRectMake(widthSpan + 2, heightSpan + 2, self.cropSize.width - 4, self.cropSize.height - 4)); + UIRectFill(CGRectMake(widthSpan + 1, heightSpan + 1, self.cropSize.width - 2, self.cropSize.height - 2)); From 1bf5ee78e1d8f9f937f962f2341f3e44c26a6b4d Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Thu, 14 Nov 2013 14:52:44 +0800 Subject: [PATCH 11/25] =?UTF-8?q?Keys=20of=20localized=20strings=20are=20n?= =?UTF-8?q?ow=20english=20fallbacks=20(in=20case=20a=20strings=20file=20is?= =?UTF-8?q?n=E2=80=99t=20provided)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GKClasses/GKImageCropOverlayView.m | 2 +- GKClasses/GKImageCropViewController.m | 12 ++++++------ GKClasses/GKImagePicker.m | 4 ++-- GKImagePicker/Localizable.strings | 13 ++++++------- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/GKClasses/GKImageCropOverlayView.m b/GKClasses/GKImageCropOverlayView.m index 0f693f2..17c54da 100644 --- a/GKClasses/GKImageCropOverlayView.m +++ b/GKClasses/GKImageCropOverlayView.m @@ -66,7 +66,7 @@ - (void)drawRect:(CGRect)rect{ if (heightSpan > 30 && (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)) { [[UIColor whiteColor] set]; - [NSLocalizedString(@"GKImoveAndScale", @"") drawInRect:CGRectMake(10, (height - heightSpan) + (heightSpan / 2 - 20 / 2) , width - 20, 20) + [NSLocalizedString(@"Move and Scale", @"Move and Scale") drawInRect:CGRectMake(10, (height - heightSpan) + (heightSpan / 2 - 20 / 2) , width - 20, 20) withFont:[UIFont boldSystemFontOfSize:20] lineBreakMode:NSLineBreakByTruncatingTail alignment:NSTextAlignmentCenter]; diff --git a/GKClasses/GKImageCropViewController.m b/GKClasses/GKImageCropViewController.m index 5df4da8..d49b543 100644 --- a/GKClasses/GKImageCropViewController.m +++ b/GKClasses/GKImageCropViewController.m @@ -56,7 +56,7 @@ - (void)_setupNavigationBar{ target:self action:@selector(_actionCancel)]; - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"GKIuse", @"") + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Use", @"Use") style:UIBarButtonItemStyleBordered target:self action:@selector(_actionUse)]; @@ -106,26 +106,26 @@ - (UIFont *)buttonFont } - (void)_setupCancelButton{ - CGSize buttonSize = [self sizeForString:NSLocalizedString(@"GKIcancel",@"") + CGSize buttonSize = [self sizeForString:NSLocalizedString(@"Cancel", @"Cancel") withFont:[self buttonFont]]; self.cancelButton = [UIButton buttonWithType:UIButtonTypeCustom]; [[self.cancelButton titleLabel] setFont:[self buttonFont]]; [self.cancelButton setFrame:CGRectMake(HORIZONTAL_TEXT_PADDING, 0, buttonSize.width, buttonSize.height)]; - [self.cancelButton setTitle:NSLocalizedString(@"GKIcancel",@"") forState:UIControlStateNormal]; + [self.cancelButton setTitle:NSLocalizedString(@"Cancel", @"Cancel") forState:UIControlStateNormal]; [self.cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlEventAllEvents]; [self.cancelButton addTarget:self action:@selector(_actionCancel) forControlEvents:UIControlEventTouchUpInside]; } - (void)_setupUseButton{ - CGSize buttonSize = [self sizeForString:NSLocalizedString(@"GKIuse",@"") + CGSize buttonSize = [self sizeForString:NSLocalizedString(@"Use",@"Use") withFont:[self buttonFont]]; self.useButton = [UIButton buttonWithType:UIButtonTypeCustom]; [[self.useButton titleLabel] setFont:[self buttonFont]]; [self.useButton setFrame:CGRectMake(self.view.frame.size.width - (buttonSize.width + HORIZONTAL_TEXT_PADDING), 0, buttonSize.width, buttonSize.height)]; - [self.useButton setTitle:NSLocalizedString(@"GKIuse",@"") forState:UIControlStateNormal]; + [self.useButton setTitle:NSLocalizedString(@"Use",@"Use") forState:UIControlStateNormal]; [self.useButton setTitleColor:[UIColor whiteColor] forState:UIControlEventAllEvents]; [self.useButton addTarget:self action:@selector(_actionUse) forControlEvents:UIControlEventTouchUpInside]; } @@ -167,7 +167,7 @@ - (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view. - self.title = NSLocalizedString(@"GKIchoosePhoto", @""); + self.title = NSLocalizedString(@"Choose Photo", @"Choose Photo"); [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; [self _setupNavigationBar]; diff --git a/GKClasses/GKImagePicker.m b/GKClasses/GKImagePicker.m index c17b7fc..541f65c 100644 --- a/GKClasses/GKImagePicker.m +++ b/GKClasses/GKImagePicker.m @@ -100,9 +100,9 @@ - (void)showActionSheetOnViewController:(UIViewController *)viewController onPop UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:(id)self - cancelButtonTitle:NSLocalizedString(@"GKIcancel", @"") + cancelButtonTitle:NSLocalizedString(@"Cancel", @"Cancel") destructiveButtonTitle:nil - otherButtonTitles:NSLocalizedString(@"GKIfromCamera", @""), NSLocalizedString(@"GKIfromLibrary", @""), nil]; + otherButtonTitles:NSLocalizedString(@"Image from Camera", @"Image from Camera"), NSLocalizedString(@"Image from Library", @"Image from Library"), nil]; actionSheet.delegate = self; if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM()) { diff --git a/GKImagePicker/Localizable.strings b/GKImagePicker/Localizable.strings index ccce66b..bf459d1 100644 --- a/GKImagePicker/Localizable.strings +++ b/GKImagePicker/Localizable.strings @@ -6,11 +6,10 @@ Copyright (c) 2012 Aurora Apps. All rights reserved. */ -"GKIchoosePhoto" = "Choose Photo"; -"GKIuse" = "Use"; -"GKImoveAndScale" = "Move and Scale"; -"GKIcancel" = "Cancel"; -"GKIuse" = "Choose"; +"Choose Photo" = "Choose Photo"; +"Use" = "Use"; +"Move and Scale" = "Move and Scale"; +"Cancel" = "Cancel"; -"GKIfromCamera" = "Image from Camera"; -"GKIfromLibrary" = "Image from Library"; \ No newline at end of file +"Image from Camera" = "Image from Camera"; +"Image from Library" = "Image from Library"; \ No newline at end of file From df5851972db13a71d3e97df087c91154e875f7be Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Thu, 14 Nov 2013 19:54:06 +0800 Subject: [PATCH 12/25] Adds podspec and modifies README --- AKImagePicker.podspec | 16 ++++++++++++++++ README.md | 31 +++++++++---------------------- 2 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 AKImagePicker.podspec diff --git a/AKImagePicker.podspec b/AKImagePicker.podspec new file mode 100644 index 0000000..ab407a7 --- /dev/null +++ b/AKImagePicker.podspec @@ -0,0 +1,16 @@ +Pod::Spec.new do |s| + s.name = 'AKImagePicker' + s.version = '0.0.1' + s.license = 'MIT' + s.platform = :ios, '7.0' + s.summary = 'Image Picker with support for custom crop areas.' + s.description = 'A fork of GKImagePicker updated for iOS 7.' + s.homepage = 'https://github.com/arkuana/AKImagePicker' + s.author = { 'Georg Kitz' => 'info@aurora-apps.com' } + s.source = { :git => 'https://github.com/arkuana/AKImagePicker.git' } + s.resources = 'GKImages/*.png' + s.source_files = 'GKClasses/*.{h,m}' + s.preserve_paths = 'GKClasses', 'GKImages' + s.frameworks = 'UIKit' + s.requires_arc = true +end diff --git a/README.md b/README.md index 8021ab5..e230f8f 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,22 @@ ### GKImagePicker -Ever wanted a custom crop area for the UIImagePickerController? Now you can have it with _GKImagePicker_. Just set your custom crop area and that's it. Just 4 lines of code. If you don't set it, it uses the same crop area as the default UIImagePickerController. +A fork of [GKImagePicker](https://github.com/gekitz/GKImagePicker) by [@gekitz](http://www.twitter.com/gekitz), taking off in a slightly different tangent. Notable changes to it are: +- Utilizes an image cropper similar to Apple's own iOS 7 redesign +- Uses the available space of the screen as much as possible regardless of the size of the image being cropped. Also ensures that large crop sizes are scaled to still fit in the screen. ### How to use it -- just drag and drop the files in under "GKClasses" & "GKImages" into your project. -- look at the sample code below. -- this project contains a sample project as well, just have a look at the implementation of `ViewController.m` -- have fun and follow [@gekitz](http://www.twitter.com/gekitz). - +- Follow the instructions found [here](https://github.com/gekitz/GKImagePicker) ### Sample Code - - self.imagePicker = [[GKImagePicker alloc] init]; - self.imagePicker.cropSize = CGSizeMake(320, 90); + + self.imagePicker = [[GKImagePicker alloc] init]; + self.imagePicker.cropSize = CGSizeMake(320, 496); self.imagePicker.delegate = self; - [self presentModalViewController:self.imagePicker.imagePickerController animated:YES]; - - -This code results into the following controller + crop area: - -![Sample Crop Image](https://dl.dropbox.com/u/311618/GKImageCrop/IMG_1509.PNG) - -It's even possible to let the user adjust the crop area (thanks to [@pathonhauser](http://www.twitter.com/pathonhauser) for this pull request) by setting one additional property: + [self.imagePicker showActionSheetOnViewController:self onPopoverFromView:btn]; - self.imagePicker.resizeableCropArea = YES; - -This code results into the following controller + adjustable crop area: -![Sample Crop Image Adjustable](https://dl.dropbox.com/u/311618/GKImageCrop/IMG_2299.PNG) -### License + ### License Under MIT. See license file for details. From 5d96856f4b043f9fcbc6797e750bb58298870af6 Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Thu, 14 Nov 2013 19:56:41 +0800 Subject: [PATCH 13/25] Fixes README --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e230f8f..fa3cbc5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -### GKImagePicker +### AKImagePicker A fork of [GKImagePicker](https://github.com/gekitz/GKImagePicker) by [@gekitz](http://www.twitter.com/gekitz), taking off in a slightly different tangent. Notable changes to it are: - Utilizes an image cropper similar to Apple's own iOS 7 redesign @@ -6,7 +6,7 @@ A fork of [GKImagePicker](https://github.com/gekitz/GKImagePicker) by [@gekitz]( ### How to use it -- Follow the instructions found [here](https://github.com/gekitz/GKImagePicker) +- Follow the instructions found [here](https://github.com/gekitz/GKImagePicker). ### Sample Code @@ -15,10 +15,10 @@ A fork of [GKImagePicker](https://github.com/gekitz/GKImagePicker) by [@gekitz]( self.imagePicker.delegate = self; [self.imagePicker showActionSheetOnViewController:self onPopoverFromView:btn]; - - ### License + +### License Under MIT. See license file for details. - \ No newline at end of file + From 6d40b9152ed0052f64d91617d1fc98b8ef59b590 Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Thu, 14 Nov 2013 21:30:14 +0800 Subject: [PATCH 14/25] Renames podspec and updates Readme --- AKImagePicker.podspec => GKImagePicker@arkuana.podspec | 8 ++++---- README.md | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) rename AKImagePicker.podspec => GKImagePicker@arkuana.podspec (57%) diff --git a/AKImagePicker.podspec b/GKImagePicker@arkuana.podspec similarity index 57% rename from AKImagePicker.podspec rename to GKImagePicker@arkuana.podspec index ab407a7..85b456f 100644 --- a/AKImagePicker.podspec +++ b/GKImagePicker@arkuana.podspec @@ -1,13 +1,13 @@ Pod::Spec.new do |s| - s.name = 'AKImagePicker' + s.name = 'GKImagePicker@arkuana' s.version = '0.0.1' s.license = 'MIT' s.platform = :ios, '7.0' s.summary = 'Image Picker with support for custom crop areas.' - s.description = 'A fork of GKImagePicker updated for iOS 7.' + s.description = 'A fork of GKImagePicker (0.0.1) updated for iOS 7, that also takes care of the default sources.' s.homepage = 'https://github.com/arkuana/AKImagePicker' - s.author = { 'Georg Kitz' => 'info@aurora-apps.com' } - s.source = { :git => 'https://github.com/arkuana/AKImagePicker.git' } + s.author = { 'Georg Kitz' => 'info@aurora-apps.com', 'Ahmed Khalaf' => 'ahmed@arkuana.co' } + s.source = { :git => 'https://github.com/arkuana/GKImagePicker.git' } s.resources = 'GKImages/*.png' s.source_files = 'GKClasses/*.{h,m}' s.preserve_paths = 'GKClasses', 'GKImages' diff --git a/README.md b/README.md index fa3cbc5..d59f7c9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -### AKImagePicker +### GKImagePicker A fork of [GKImagePicker](https://github.com/gekitz/GKImagePicker) by [@gekitz](http://www.twitter.com/gekitz), taking off in a slightly different tangent. Notable changes to it are: - Utilizes an image cropper similar to Apple's own iOS 7 redesign From 3a65c061f4ca77707d8bb354fb28de9d1f68a5b3 Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Thu, 14 Nov 2013 21:34:36 +0800 Subject: [PATCH 15/25] Hopefully validates podspec --- GKImagePicker@arkuana.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GKImagePicker@arkuana.podspec b/GKImagePicker@arkuana.podspec index 85b456f..a052a96 100644 --- a/GKImagePicker@arkuana.podspec +++ b/GKImagePicker@arkuana.podspec @@ -1,13 +1,13 @@ Pod::Spec.new do |s| s.name = 'GKImagePicker@arkuana' - s.version = '0.0.1' + s.version = '0.0.3' s.license = 'MIT' s.platform = :ios, '7.0' s.summary = 'Image Picker with support for custom crop areas.' s.description = 'A fork of GKImagePicker (0.0.1) updated for iOS 7, that also takes care of the default sources.' s.homepage = 'https://github.com/arkuana/AKImagePicker' s.author = { 'Georg Kitz' => 'info@aurora-apps.com', 'Ahmed Khalaf' => 'ahmed@arkuana.co' } - s.source = { :git => 'https://github.com/arkuana/GKImagePicker.git' } + s.source = { :git => 'https://github.com/arkuana/GKImagePicker.git', :tag => s.version.to_s } s.resources = 'GKImages/*.png' s.source_files = 'GKClasses/*.{h,m}' s.preserve_paths = 'GKClasses', 'GKImages' From 50ce1c5fcb91a5b2fad4715b57c66ee03c65947c Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Thu, 14 Nov 2013 22:54:51 +0800 Subject: [PATCH 16/25] Fixes warnings --- GKClasses/GKImageCropOverlayView.m | 11 ----------- GKClasses/GKImageCropViewController.m | 4 ++-- GKClasses/GKImagePicker.m | 2 +- GKImagePicker.xcodeproj/project.pbxproj | 4 ++-- GKImagePicker/ViewController.m | 2 +- GKImagePicker@arkuana.podspec | 2 +- 6 files changed, 7 insertions(+), 18 deletions(-) diff --git a/GKClasses/GKImageCropOverlayView.m b/GKClasses/GKImageCropOverlayView.m index 17c54da..20b5a80 100644 --- a/GKClasses/GKImageCropOverlayView.m +++ b/GKClasses/GKImageCropOverlayView.m @@ -61,17 +61,6 @@ - (void)drawRect:(CGRect)rect{ // UIRectFill(CGRectMake(widthSpan + 2, heightSpan + 2, self.cropSize.width - 4, self.cropSize.height - 4)); UIRectFill(CGRectMake(widthSpan + 1, heightSpan + 1, self.cropSize.width - 2, self.cropSize.height - 2)); - - - if (heightSpan > 30 && (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)) { - - [[UIColor whiteColor] set]; - [NSLocalizedString(@"Move and Scale", @"Move and Scale") drawInRect:CGRectMake(10, (height - heightSpan) + (heightSpan / 2 - 20 / 2) , width - 20, 20) - withFont:[UIFont boldSystemFontOfSize:20] - lineBreakMode:NSLineBreakByTruncatingTail - alignment:NSTextAlignmentCenter]; - - } } @end diff --git a/GKClasses/GKImageCropViewController.m b/GKClasses/GKImageCropViewController.m index d49b543..1e0c3d1 100644 --- a/GKClasses/GKImageCropViewController.m +++ b/GKClasses/GKImageCropViewController.m @@ -113,7 +113,7 @@ - (void)_setupCancelButton{ [[self.cancelButton titleLabel] setFont:[self buttonFont]]; [self.cancelButton setFrame:CGRectMake(HORIZONTAL_TEXT_PADDING, 0, buttonSize.width, buttonSize.height)]; [self.cancelButton setTitle:NSLocalizedString(@"Cancel", @"Cancel") forState:UIControlStateNormal]; - [self.cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlEventAllEvents]; + [self.cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [self.cancelButton addTarget:self action:@selector(_actionCancel) forControlEvents:UIControlEventTouchUpInside]; } @@ -126,7 +126,7 @@ - (void)_setupUseButton{ [[self.useButton titleLabel] setFont:[self buttonFont]]; [self.useButton setFrame:CGRectMake(self.view.frame.size.width - (buttonSize.width + HORIZONTAL_TEXT_PADDING), 0, buttonSize.width, buttonSize.height)]; [self.useButton setTitle:NSLocalizedString(@"Use",@"Use") forState:UIControlStateNormal]; - [self.useButton setTitleColor:[UIColor whiteColor] forState:UIControlEventAllEvents]; + [self.useButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [self.useButton addTarget:self action:@selector(_actionUse) forControlEvents:UIControlEventTouchUpInside]; } diff --git a/GKClasses/GKImagePicker.m b/GKClasses/GKImagePicker.m index 541f65c..5b545dc 100644 --- a/GKClasses/GKImagePicker.m +++ b/GKClasses/GKImagePicker.m @@ -69,7 +69,7 @@ - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ GKImageCropViewController *cropController = [[GKImageCropViewController alloc] init]; - cropController.contentSizeForViewInPopover = picker.contentSizeForViewInPopover; + cropController.preferredContentSize = picker.preferredContentSize; cropController.sourceImage = [info objectForKey:UIImagePickerControllerOriginalImage]; cropController.resizeableCropArea = self.resizeableCropArea; cropController.cropSize = self.cropSize; diff --git a/GKImagePicker.xcodeproj/project.pbxproj b/GKImagePicker.xcodeproj/project.pbxproj index 05a4561..fa5f296 100644 --- a/GKImagePicker.xcodeproj/project.pbxproj +++ b/GKImagePicker.xcodeproj/project.pbxproj @@ -347,7 +347,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "GKImagePicker/GKImagePicker-Prefix.pch"; INFOPLIST_FILE = "GKImagePicker/GKImagePicker-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(FRANK_LIBRARY_SEARCH_PATHS)", @@ -367,7 +367,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "GKImagePicker/GKImagePicker-Prefix.pch"; INFOPLIST_FILE = "GKImagePicker/GKImagePicker-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; diff --git a/GKImagePicker/ViewController.m b/GKImagePicker/ViewController.m index 0bf35a7..5ee070e 100644 --- a/GKImagePicker/ViewController.m +++ b/GKImagePicker/ViewController.m @@ -52,7 +52,7 @@ - (void)showNormalPicker:(UIButton *)btn{ } else { - [self presentModalViewController:self.ctr animated:YES]; + [self presentViewController:self.ctr animated:YES completion:nil]; } diff --git a/GKImagePicker@arkuana.podspec b/GKImagePicker@arkuana.podspec index a052a96..09a863d 100644 --- a/GKImagePicker@arkuana.podspec +++ b/GKImagePicker@arkuana.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'GKImagePicker@arkuana' - s.version = '0.0.3' + s.version = '0.0.4' s.license = 'MIT' s.platform = :ios, '7.0' s.summary = 'Image Picker with support for custom crop areas.' From 1791cb3ef801aabd1c081cf1992a4f2515df1cd9 Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Thu, 14 Nov 2013 23:05:48 +0800 Subject: [PATCH 17/25] Fixes deployment target --- GKImagePicker.xcodeproj/project.pbxproj | 4 ++-- GKImagePicker/GKImagePicker-Info.plist | 2 +- GKImagePicker@arkuana.podspec | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GKImagePicker.xcodeproj/project.pbxproj b/GKImagePicker.xcodeproj/project.pbxproj index fa5f296..343e019 100644 --- a/GKImagePicker.xcodeproj/project.pbxproj +++ b/GKImagePicker.xcodeproj/project.pbxproj @@ -313,7 +313,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -333,7 +333,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; diff --git a/GKImagePicker/GKImagePicker-Info.plist b/GKImagePicker/GKImagePicker-Info.plist index 004ad12..41a1f0c 100644 --- a/GKImagePicker/GKImagePicker-Info.plist +++ b/GKImagePicker/GKImagePicker-Info.plist @@ -11,7 +11,7 @@ CFBundleIdentifier com.aurora-apps.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion - 6.0 + 7.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType diff --git a/GKImagePicker@arkuana.podspec b/GKImagePicker@arkuana.podspec index 09a863d..d6b755d 100644 --- a/GKImagePicker@arkuana.podspec +++ b/GKImagePicker@arkuana.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'GKImagePicker@arkuana' - s.version = '0.0.4' + s.version = '0.0.1' s.license = 'MIT' s.platform = :ios, '7.0' s.summary = 'Image Picker with support for custom crop areas.' From 74e8d190146d1600c8400a1290363c531a368bfa Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Thu, 14 Nov 2013 23:36:01 +0800 Subject: [PATCH 18/25] Fixes deprecated method --- GKClasses/GKImageCropViewController.m | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/GKClasses/GKImageCropViewController.m b/GKClasses/GKImageCropViewController.m index 1e0c3d1..e9b6638 100644 --- a/GKClasses/GKImageCropViewController.m +++ b/GKClasses/GKImageCropViewController.m @@ -93,11 +93,22 @@ - (void)_setupCropView{ - (CGSize)sizeForString:(NSString *)string withFont:(UIFont *)font{ NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init]; attributes[NSFontAttributeName] = font; - CGRect labelRect = [string boundingRectWithSize:CGSizeMake(320.f, TOOLBAR_HEIGHT) - options:NSStringDrawingUsesLineFragmentOrigin - attributes:attributes - context:nil]; - return CGSizeMake(labelRect.size.width, TOOLBAR_HEIGHT); + + CGSize constrainedSize = CGSizeMake(320.f, TOOLBAR_HEIGHT); + CGSize neededSize; + if ([string respondsToSelector:@selector(boundingRectWithSize:options:attributes:context:)]) { + neededSize = [string boundingRectWithSize:constrainedSize + options:NSStringDrawingUsesLineFragmentOrigin + attributes:attributes + context:nil].size; + } else { +#if __IPHONE_OS_VERSION_MAX_ALLOWED <= 60000 + neededSize = [string sizeWithFont:font + constrainedToSize:constrainedSize + lineBreakMode:NSLineBreakByTruncatingMiddle]; +#endif + } + return CGSizeMake(neededSize.width, TOOLBAR_HEIGHT); } - (UIFont *)buttonFont From ae02563ff7eafe0880c0d455e01f841b5a6c6085 Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Thu, 14 Nov 2013 23:59:27 +0800 Subject: [PATCH 19/25] Fixes for cocoapods --- GKClasses/GKImageCropViewController.m | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/GKClasses/GKImageCropViewController.m b/GKClasses/GKImageCropViewController.m index e9b6638..5fea254 100644 --- a/GKClasses/GKImageCropViewController.m +++ b/GKClasses/GKImageCropViewController.m @@ -95,19 +95,18 @@ - (CGSize)sizeForString:(NSString *)string withFont:(UIFont *)font{ attributes[NSFontAttributeName] = font; CGSize constrainedSize = CGSizeMake(320.f, TOOLBAR_HEIGHT); - CGSize neededSize; - if ([string respondsToSelector:@selector(boundingRectWithSize:options:attributes:context:)]) { - neededSize = [string boundingRectWithSize:constrainedSize - options:NSStringDrawingUsesLineFragmentOrigin - attributes:attributes - context:nil].size; - } else { -#if __IPHONE_OS_VERSION_MAX_ALLOWED <= 60000 - neededSize = [string sizeWithFont:font + CGSize neededSize = CGSizeMake(0, 0); + +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 + neededSize = [string boundingRectWithSize:constrainedSize + options:NSStringDrawingUsesLineFragmentOrigin + attributes:attributes + context:nil].size; +#else + neededSize = [string sizeWithFont:font constrainedToSize:constrainedSize - lineBreakMode:NSLineBreakByTruncatingMiddle]; + lineBreakMode:NSLineBreakByTruncatingMiddle]; #endif - } return CGSizeMake(neededSize.width, TOOLBAR_HEIGHT); } From 4240ba5539ac2c34ab5c6846ac2d5dfc06e5017d Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Fri, 15 Nov 2013 00:09:55 +0800 Subject: [PATCH 20/25] Fixes another backwards compatibility issue --- GKClasses/GKImagePicker.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GKClasses/GKImagePicker.m b/GKClasses/GKImagePicker.m index 5b545dc..771a64e 100644 --- a/GKClasses/GKImagePicker.m +++ b/GKClasses/GKImagePicker.m @@ -69,7 +69,11 @@ - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ GKImageCropViewController *cropController = [[GKImageCropViewController alloc] init]; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 cropController.preferredContentSize = picker.preferredContentSize; +#else + cropController.contentSizeForViewInPopover = picker.contentSizeForViewInPopover; +#endif cropController.sourceImage = [info objectForKey:UIImagePickerControllerOriginalImage]; cropController.resizeableCropArea = self.resizeableCropArea; cropController.cropSize = self.cropSize; From 842f6bc46c56839b3ee24bc01c1a3d8b2f7fb225 Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Sat, 16 Nov 2013 17:36:18 +0800 Subject: [PATCH 21/25] =?UTF-8?q?Clips=20image=20so=20it=20doesn=E2=80=99t?= =?UTF-8?q?=20show=20out=20of=20bounds=20while=20view=20controller=20is=20?= =?UTF-8?q?being=20pushed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GKClasses/GKImageCropViewController.m | 1 + 1 file changed, 1 insertion(+) diff --git a/GKClasses/GKImageCropViewController.m b/GKClasses/GKImageCropViewController.m index 5fea254..f055429 100644 --- a/GKClasses/GKImageCropViewController.m +++ b/GKClasses/GKImageCropViewController.m @@ -87,6 +87,7 @@ - (void)_setupCropView{ [self.imageCropView setImageToCrop:sourceImage]; [self.imageCropView setResizableCropArea:self.resizeableCropArea]; [self.imageCropView setCropSize:[self normalizedCropSizeForRect:self.view.bounds]]; + self.imageCropView.clipsToBounds = YES; [self.view addSubview:self.imageCropView]; } From 1d99309665567b1948f6812b8bf33bd1276493d0 Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Sat, 16 Nov 2013 17:37:45 +0800 Subject: [PATCH 22/25] Updates Podspec --- GKImagePicker@arkuana.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GKImagePicker@arkuana.podspec b/GKImagePicker@arkuana.podspec index d6b755d..dc22a8e 100644 --- a/GKImagePicker@arkuana.podspec +++ b/GKImagePicker@arkuana.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'GKImagePicker@arkuana' - s.version = '0.0.1' + s.version = '0.0.2' s.license = 'MIT' s.platform = :ios, '7.0' s.summary = 'Image Picker with support for custom crop areas.' From 71ee620bc371082a0c6cc84314fc8b4dfbc82ffc Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Sun, 17 Nov 2013 10:50:28 +0800 Subject: [PATCH 23/25] Shows action sheet from toolbar, if present (otherwise the cancel button isn't responsive) --- GKClasses/GKImagePicker.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GKClasses/GKImagePicker.m b/GKClasses/GKImagePicker.m index 771a64e..d55a669 100644 --- a/GKClasses/GKImagePicker.m +++ b/GKClasses/GKImagePicker.m @@ -112,7 +112,11 @@ - (void)showActionSheetOnViewController:(UIViewController *)viewController onPop if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM()) { [actionSheet showFromRect:self.popoverView.frame inView:self.presentingViewController.view animated:YES]; } else { - [actionSheet showInView:self.presentingViewController.view]; + if (self.presentingViewController.navigationController.toolbar) { + [actionSheet showFromToolbar:self.presentingViewController.navigationController.toolbar]; + } else { + [actionSheet showInView:self.presentingViewController.view]; + } } } From f9366bfed9719baf8c333ec4d2b8c5ae97c820a5 Mon Sep 17 00:00:00 2001 From: Ahmed Khalaf Date: Sun, 17 Nov 2013 10:51:06 +0800 Subject: [PATCH 24/25] updates podspec --- GKImagePicker@arkuana.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GKImagePicker@arkuana.podspec b/GKImagePicker@arkuana.podspec index dc22a8e..a052a96 100644 --- a/GKImagePicker@arkuana.podspec +++ b/GKImagePicker@arkuana.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'GKImagePicker@arkuana' - s.version = '0.0.2' + s.version = '0.0.3' s.license = 'MIT' s.platform = :ios, '7.0' s.summary = 'Image Picker with support for custom crop areas.' From 1737b1c69f31c390f25e0646d99740e2df0dadca Mon Sep 17 00:00:00 2001 From: Tim Molter Date: Thu, 4 Dec 2014 09:07:11 +0100 Subject: [PATCH 25/25] removed hardcoded width, set it to screen width --- GKClasses/GKImageCropViewController.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GKClasses/GKImageCropViewController.m b/GKClasses/GKImageCropViewController.m index f055429..cb1153b 100644 --- a/GKClasses/GKImageCropViewController.m +++ b/GKClasses/GKImageCropViewController.m @@ -95,7 +95,7 @@ - (CGSize)sizeForString:(NSString *)string withFont:(UIFont *)font{ NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init]; attributes[NSFontAttributeName] = font; - CGSize constrainedSize = CGSizeMake(320.f, TOOLBAR_HEIGHT); + CGSize constrainedSize = CGSizeMake(self.view.frame.size.width, TOOLBAR_HEIGHT); CGSize neededSize = CGSizeMake(0, 0); #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 @@ -207,7 +207,7 @@ - (void)viewWillLayoutSubviews{ [super viewWillLayoutSubviews]; self.imageCropView.frame = self.view.bounds; - self.toolbarView.frame = CGRectMake(0, CGRectGetHeight(self.view.frame) - TOOLBAR_HEIGHT, 320, TOOLBAR_HEIGHT); + self.toolbarView.frame = CGRectMake(0, CGRectGetHeight(self.view.frame) - TOOLBAR_HEIGHT, self.view.frame.size.width, TOOLBAR_HEIGHT); } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation