├── .gitignore ├── CropperView ├── CropperCornerManager.h ├── CropperCornerManager.m ├── CropperCornerView.h ├── CropperCornerView.m ├── CropperCornerView.png ├── CropperView.h ├── CropperView.m ├── ICropper.h └── ICropperCorner.h ├── CropperViewDemo ├── CropperViewDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── CropperViewDemo.xccheckout │ │ └── xcuserdata │ │ │ ├── IM050.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── tiny2n.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ ├── IM050.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ ├── CropperViewDemo.xcscheme │ │ │ └── xcschememanagement.plist │ │ └── tiny2n.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── CropperViewDemo.xcscheme │ │ └── xcschememanagement.plist ├── CropperViewDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── Main.storyboard │ ├── CropperViewDemo-Info.plist │ ├── CropperViewDemo-Prefix.pch │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── ViewController.h │ ├── ViewController.m │ ├── background@2x.png │ ├── en.lproj │ │ └── InfoPlist.strings │ └── main.m └── CropperViewDemoTests │ ├── CropperViewDemoTests-Info.plist │ ├── CropperViewDemoTests.m │ └── en.lproj │ └── InfoPlist.strings ├── LICENSE ├── README.md └── Screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | # CocoaPods 2 | # 3 | # We recommend against adding the Pods directory to your .gitignore. However 4 | # you should judge for yourself, the pros and cons are mentioned at: 5 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control? 6 | # 7 | # Pods/ 8 | 9 | -------------------------------------------------------------------------------- /CropperView/CropperCornerManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // CropperCornerManager.h 3 | // Cropper 4 | // 5 | // Created by 최 중관 on 2014. 7. 18.. 6 | // Copyright (c) 2014년 JoongKwan Choi. All rights reserved. 7 | // 8 | 9 | #import "CropperCornerView.h" 10 | 11 | #import "ICropper.h" 12 | 13 | @protocol ICropperCornerManager 14 | @required 15 | - (BOOL)hasCropperCornersWithCornerMode:(CropperCornerMode)cropperCornerMode index:(NSInteger)index; 16 | - (NSArray *)cropperCornersWithCornerMode:(CropperCornerMode)cropperCornerMode index:(NSInteger)index; 17 | - (NSUInteger)cornerIndexFromCGPoint:(CGPoint)point; 18 | @end 19 | 20 | @interface CropperCornerManager : NSObject 21 | 22 | - (instancetype)initWithView:(UIView *)view; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /CropperView/CropperCornerManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // CropperCornerManager.m 3 | // Cropper 4 | // 5 | // Created by 최 중관 on 2014. 7. 18.. 6 | // Copyright (c) 2014년 JoongKwan Choi. All rights reserved. 7 | // 8 | 9 | 10 | #import "CropperCornerManager.h" 11 | 12 | #import "CropperCornerView.h" 13 | 14 | static NSUInteger const kCropperConerSize = 22; // 코너 이미지 사이즈 15 | 16 | @interface CropperCornerManager() { 17 | 18 | __weak UIView * _view; 19 | NSUInteger _count; 20 | } 21 | 22 | @end 23 | 24 | @implementation CropperCornerManager 25 | 26 | - (instancetype)init { 27 | @throw [NSException exceptionWithName:NSInternalInconsistencyException 28 | reason:@"You must call select that initWithView:" 29 | userInfo:nil]; 30 | } 31 | 32 | - (instancetype)initWithView:(UIView *)view { 33 | if (self = [super init]) { 34 | _count = 0; 35 | _view = view; 36 | } 37 | 38 | return self; 39 | } 40 | 41 | - (void)dealloc { 42 | _view = nil; 43 | } 44 | 45 | /** 46 | 한 코너 정보 세트를 등록하는 메소드 47 | @param CGRect 48 | */ 49 | - (void)addCropper:(CGRect)cropper { 50 | 51 | CGFloat x = CGRectGetMinX(cropper) - (kCropperConerSize / 2); 52 | CGFloat y = CGRectGetMinY(cropper) - (kCropperConerSize / 2); 53 | CGFloat width = x + CGRectGetWidth(cropper); 54 | CGFloat height = y + CGRectGetHeight(cropper); 55 | 56 | 57 | CropperCornerView * LT = [[CropperCornerView alloc] initWithFrame:CGRectMake(x, y, kCropperConerSize, kCropperConerSize)]; // Left & Top corner 58 | CropperCornerView * LB = [[CropperCornerView alloc] initWithFrame:CGRectMake(x, height, kCropperConerSize, kCropperConerSize)]; // Left & Bottom corner 59 | CropperCornerView * RT = [[CropperCornerView alloc] initWithFrame:CGRectMake(width, y, kCropperConerSize, kCropperConerSize)]; // Right & Top corner 60 | CropperCornerView * RB = [[CropperCornerView alloc] initWithFrame:CGRectMake(width, height, kCropperConerSize, kCropperConerSize)]; // Right & Bottom corner 61 | 62 | [LT setDelegate:self]; 63 | [LB setDelegate:self]; 64 | [RT setDelegate:self]; 65 | [RB setDelegate:self]; 66 | 67 | [LT setIndex:_count]; 68 | [LB setIndex:_count]; 69 | [RT setIndex:_count]; 70 | [RB setIndex:_count]; 71 | 72 | [LT setCropperCornerMode:CropperCornerModeLeft | CropperCornerModeTop | CropperCornerModeTopLeft ]; // 크기를 구하기 위해 좌상단 플래그 추가 등록 73 | [LB setCropperCornerMode:CropperCornerModeLeft | CropperCornerModeBottom ]; 74 | [RT setCropperCornerMode:CropperCornerModeRight | CropperCornerModeTop ]; 75 | [RB setCropperCornerMode:CropperCornerModeRight | CropperCornerModeBottom | CropperCornerModeBottomRight ]; // 크기를 구하기 위해 우하단 플래그 추가 등록 76 | 77 | [_view addSubview:LT]; 78 | [_view addSubview:LB]; 79 | [_view addSubview:RT]; 80 | [_view addSubview:RB]; 81 | 82 | _count++; 83 | 84 | [_view setNeedsDisplay]; 85 | } 86 | 87 | /** 88 | 모든 코너 정보를 제거하는 메소드 89 | */ 90 | - (void)removeAllCroppers { 91 | _count = 0; 92 | 93 | [[_view subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)]; 94 | [_view setNeedsDisplay]; 95 | } 96 | 97 | /** 98 | index에 해당하는 코너 정보를 제거하는 메소드 99 | @param NSInteger 100 | */ 101 | - (void)removeCropperWithIndex:(NSInteger)index { 102 | for (UIView * view in [_view subviews]) { 103 | if ([view tag] == index) { 104 | _count--; 105 | [view removeFromSuperview]; 106 | } 107 | } 108 | 109 | [_view setNeedsDisplay]; 110 | } 111 | 112 | /** 113 | 코너들의 세트 갯수를 반환하는 메소드 114 | 상좌, 상우, 하좌, 하우가 1세트 115 | @return NSUInteger 116 | */ 117 | - (NSUInteger)count { 118 | return _count; 119 | } 120 | 121 | /** 122 | 특정 인덱스에 해당하는 코너 정보의 존재를 반환하는 메소드 123 | @param CropperCornerMode 124 | @param NSInteger 125 | @return BOOL 126 | */ 127 | - (BOOL)hasCropperCornersWithCornerMode:(CropperCornerMode)cropperCornerMode index:(NSInteger)index { 128 | for (UIView * subview in [_view subviews]) { 129 | if ([subview conformsToProtocol:@protocol(ICropperCorner)]) { 130 | id cropperCorner = (id)subview; 131 | 132 | if (([cropperCorner index] == index) && // 같은 index 133 | ([cropperCorner cropperCornerMode] & cropperCornerMode)) { // 같은 corner mode 134 | return YES; 135 | } 136 | } 137 | } 138 | 139 | return NO; 140 | } 141 | 142 | /** 143 | 클롭퍼 코너 모드와 인덱스에 맞는 코너 객체 반환하는 메소드 144 | @param CropperCornerMode 145 | @param NSInteger 146 | @return NSArray 147 | */ 148 | - (NSArray *)cropperCornersWithCornerMode:(CropperCornerMode)cropperCornerMode index:(NSInteger)index { 149 | NSMutableArray * ret = [NSMutableArray arrayWithCapacity:_count]; 150 | for (UIView * subview in [_view subviews]) { 151 | if ([subview conformsToProtocol:@protocol(ICropperCorner)]) { 152 | id cropperCorner = (id)subview; 153 | 154 | if (([cropperCorner index] == index) && // 같은 index 155 | ([cropperCorner cropperCornerMode] & cropperCornerMode)) { // 같은 corner mode 156 | [ret addObject:cropperCorner]; 157 | } 158 | } 159 | } 160 | 161 | return ret; 162 | } 163 | 164 | /** 165 | 인덱스에 맞는 코너 객체들의 frame을 반환하는 메소드 166 | @param NSUInteger 167 | @return CGRect 168 | */ 169 | - (CGRect)cropperCornerFrameFromIndex:(NSUInteger)index { 170 | if (![self hasCropperCornersWithCornerMode:CropperCornerModeTopLeft index:index]) return CGRectZero; 171 | if (![self hasCropperCornersWithCornerMode:CropperCornerModeBottomRight index:index]) return CGRectZero; 172 | 173 | id TL = [self cropperCornersWithCornerMode:CropperCornerModeTopLeft index:index][0]; 174 | id BR = [self cropperCornersWithCornerMode:CropperCornerModeBottomRight index:index][0]; 175 | 176 | return CGRectMake(TL.center.x, 177 | TL.center.y, 178 | BR.center.x - TL.center.x, 179 | BR.center.y - TL.center.y); 180 | } 181 | 182 | /** 183 | 포인트를 포함하고 있는 코너의 인덱스를 반환하는 메소드 184 | @param CGPoint 185 | @return NSUInteger 186 | */ 187 | - (NSUInteger)cornerIndexFromCGPoint:(CGPoint)point { 188 | for (NSUInteger i = 0; i < _count; i++) { 189 | CGRect frame = [self cropperCornerFrameFromIndex:i]; 190 | if (CGRectContainsPoint(frame, point)) { 191 | return i; 192 | } 193 | } 194 | 195 | return -1; 196 | } 197 | 198 | #pragma mark - 199 | #pragma mark UICropperCornerViewDelegate 200 | - (void)cropperCorner:(id)cropperCorner { 201 | NSInteger index = [cropperCorner index]; 202 | CropperCornerMode CCM = [cropperCorner cropperCornerMode]; 203 | 204 | // 현재 인덱스 중 코너 모드와 연결된 205 | // ex,. TL -> BL & TR 206 | // ex,. BR -> TR & BL 207 | for (id cropperCorner in [self cropperCornersWithCornerMode:CCM index:index]) { 208 | [cropperCorner setBeganCenter]; 209 | } 210 | } 211 | 212 | - (void)cropperCorner:(id)cropperCorner translate:(CGPoint)translate cropperCornerMode:(CropperCornerMode)cropperCornerMode { 213 | NSInteger index = [cropperCorner index]; 214 | for (id cropperCorner in [self cropperCornersWithCornerMode:cropperCornerMode index:index]) { 215 | [cropperCorner setTranslate:translate cropperCornerMode:cropperCornerMode]; 216 | } 217 | 218 | [_view setNeedsDisplay]; 219 | } 220 | 221 | 222 | @end 223 | -------------------------------------------------------------------------------- /CropperView/CropperCornerView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CropperCornerView.h 3 | // Cropper 4 | // 5 | // Created by 최 중관 on 2014. 7. 18.. 6 | // Copyright (c) 2014년 JoongKwan Choi. All rights reserved. 7 | // 8 | 9 | #import "ICropperCorner.h" 10 | 11 | @protocol CropperCornerViewDelegate; 12 | 13 | @interface CropperCornerView : UIView 14 | 15 | @property (nonatomic, weak) id delegate; 16 | 17 | @end 18 | 19 | @protocol CropperCornerViewDelegate 20 | @required 21 | - (void)cropperCorner:(id)cropperCorner; 22 | - (void)cropperCorner:(id)cropperCorner translate:(CGPoint)translate cropperCornerMode:(CropperCornerMode)cropperCornerMode; 23 | @end 24 | 25 | 26 | -------------------------------------------------------------------------------- /CropperView/CropperCornerView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CropperCornerView.m 3 | // Cropper 4 | // 5 | // Created by 최 중관 on 2014. 7. 18.. 6 | // Copyright (c) 2014년 JoongKwan Choi. All rights reserved. 7 | // 8 | 9 | #import "CropperCornerView.h" 10 | 11 | @interface CropperCornerView() { 12 | 13 | CGPoint _beganCenter; 14 | } 15 | @end 16 | 17 | @implementation CropperCornerView 18 | 19 | @synthesize cropperCornerMode; 20 | @synthesize index = tag; 21 | 22 | - (void)cc_initialization { 23 | cropperCornerMode = CropperCornerModeNone; 24 | 25 | UIImageView * cornerImage = [[UIImageView alloc] initWithFrame:self.bounds]; 26 | [cornerImage setImage:[UIImage imageNamed:@"CropperCornerView.png"]]; 27 | [self addSubview:cornerImage]; 28 | 29 | // add GestureRecognizer 30 | UIPanGestureRecognizer * panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureRecognizer:)]; 31 | [self addGestureRecognizer:panGestureRecognizer]; 32 | } 33 | 34 | #pragma mark - 35 | #pragma mark life-cycle 36 | - (instancetype)init { 37 | if (self = [super init]) { 38 | // Initialization code 39 | [self cc_initialization]; 40 | } 41 | 42 | return self; 43 | } 44 | 45 | - (instancetype)initWithFrame:(CGRect)frame { 46 | if (self = [super initWithFrame:frame]) { 47 | // Initialization code 48 | [self cc_initialization]; 49 | } 50 | 51 | return self; 52 | } 53 | 54 | - (void)awakeFromNib { 55 | [super awakeFromNib]; 56 | 57 | // Initialization code 58 | [self cc_initialization]; 59 | } 60 | 61 | - (void)dealloc { 62 | _delegate = nil; 63 | } 64 | 65 | /** 66 | 코너의 위치를 등록하는 메소드 67 | */ 68 | - (void)setBeganCenter { 69 | _beganCenter = [self center]; 70 | } 71 | 72 | /** 73 | 코너를 이동하는 메소드 74 | @param CGPoint 75 | @param CropperCornerMode 76 | */ 77 | - (void)setTranslate:(CGPoint)translate cropperCornerMode:(CropperCornerMode)newCropperCornerMode { 78 | // ex,. 우측 & 아래 움직일땐 ... 79 | // 우축 & 위 ... Y 고정 80 | // 좌측 & 아래 ... X 고정 81 | // 좌측 & 위 ... X, Y고정 82 | CGPoint newPoint = _beganCenter; 83 | 84 | if ((cropperCornerMode & newCropperCornerMode & CropperCornerModeLeft) || 85 | (cropperCornerMode & newCropperCornerMode & CropperCornerModeRight)) { 86 | newPoint.x += translate.x; 87 | } 88 | 89 | if ((cropperCornerMode & newCropperCornerMode & CropperCornerModeTop) || 90 | (cropperCornerMode & newCropperCornerMode & CropperCornerModeBottom)) { 91 | newPoint.y += translate.y; 92 | } 93 | 94 | [self setCenter:newPoint]; 95 | } 96 | 97 | #pragma mark - 98 | #pragma mark UIPanGestureRecognizer 99 | - (void)panGestureRecognizer:(UIPanGestureRecognizer *)sender { 100 | switch ([sender state]) { 101 | case UIGestureRecognizerStateBegan: { 102 | if ([_delegate respondsToSelector:@selector(cropperCorner:)]) { 103 | // began center 104 | [_delegate cropperCorner:self]; 105 | } 106 | break; 107 | } 108 | case UIGestureRecognizerStateChanged: { 109 | CGPoint translate = [sender translationInView:[sender view]]; 110 | if ([_delegate respondsToSelector:@selector(cropperCorner:translate:cropperCornerMode:)]) { 111 | // translate 112 | [_delegate cropperCorner:self translate:translate cropperCornerMode:[self cropperCornerMode]]; 113 | } 114 | break; 115 | } 116 | default: 117 | [self setBeganCenter]; 118 | break; 119 | } 120 | } 121 | 122 | @end 123 | -------------------------------------------------------------------------------- /CropperView/CropperCornerView.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tiny2n/CropperView/01bbe49bd3d4f9040b9a760377219331941fa100/CropperView/CropperCornerView.png -------------------------------------------------------------------------------- /CropperView/CropperView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CropperView.m 3 | // Cropper 4 | // 5 | // Created by 최 중관 on 2014. 7. 18.. 6 | // Copyright (c) 2014년 JoongKwan Choi. All rights reserved. 7 | // 8 | 9 | #import "ICropper.h" 10 | 11 | @interface CropperView : UIView 12 | 13 | @property (nonatomic, strong) UIImage * image; 14 | @property (nonatomic, strong) UIColor * contentColor; 15 | 16 | - (UIImage *)cropAtIndex:(NSUInteger)index; 17 | - (NSArray *)crop; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CropperView/CropperView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CropperView.m 3 | // Cropper 4 | // 5 | // Created by 최 중관 on 2014. 7. 18.. 6 | // Copyright (c) 2014년 JoongKwan Choi. All rights reserved. 7 | // 8 | 9 | #import "CropperView.h" 10 | 11 | #import "CropperCornerManager.h" 12 | 13 | static NSInteger const kCropperIndexDefault = -1; 14 | 15 | @interface CropperView() { 16 | 17 | id _cropperCornerManager; 18 | NSInteger _currentCropperIndex; 19 | } 20 | 21 | @end 22 | 23 | @implementation CropperView 24 | 25 | - (void)cc_initialization { 26 | [self setBackgroundColor:[UIColor clearColor]]; 27 | 28 | _contentColor = [UIColor colorWithWhite:0.0f alpha:0.4f]; 29 | _cropperCornerManager = [[CropperCornerManager alloc] initWithView:self]; 30 | 31 | // add GestureRecognizer 32 | UIPanGestureRecognizer * panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureRecognizer:)]; 33 | [self addGestureRecognizer:panGestureRecognizer]; 34 | } 35 | 36 | #pragma mark - 37 | #pragma mark life-cycle 38 | - (instancetype)init { 39 | if (self = [super init]) { 40 | // Initialization code 41 | [self cc_initialization]; 42 | } 43 | 44 | return self; 45 | } 46 | 47 | - (instancetype)initWithFrame:(CGRect)frame { 48 | if (self = [super initWithFrame:frame]) { 49 | // Initialization code 50 | [self cc_initialization]; 51 | } 52 | 53 | return self; 54 | } 55 | 56 | - (void)awakeFromNib { 57 | [super awakeFromNib]; 58 | 59 | // Initialization code 60 | [self cc_initialization]; 61 | } 62 | 63 | - (void)dealloc { 64 | _image = nil; 65 | [self removeAllCroppers]; 66 | } 67 | 68 | #pragma mark - 69 | #pragma mark ICropper 70 | /** 71 | 코너 정보 세트 추가 72 | @param CGRect 73 | */ 74 | - (void)addCropper:(CGRect)cropper { 75 | [_cropperCornerManager addCropper:cropper]; 76 | } 77 | 78 | /** 79 | 모든 코너 정보 제거 80 | */ 81 | - (void)removeAllCroppers { 82 | [_cropperCornerManager removeAllCroppers]; 83 | } 84 | 85 | /** 86 | 인덱스에 해당하는 코너들의 Rect를 반환하는 메소드 87 | @param NSUInteger 88 | @return CGRect 89 | */ 90 | - (CGRect)cropperCornerFrameFromIndex:(NSUInteger)index { 91 | return [_cropperCornerManager cropperCornerFrameFromIndex:index]; 92 | } 93 | 94 | /** 95 | 코너 세트의 갯수를 반환하는 메소드 96 | @return NSUInteger 97 | */ 98 | - (NSUInteger)count { 99 | return [_cropperCornerManager count]; 100 | } 101 | 102 | #pragma mark - 103 | #pragma mark crop 104 | /** 105 | 특정 인덱스 코너 세트들을 이용하여 Crop Image를 반환하는 메소드 106 | @param NSUInteger 107 | @return UIImage 108 | */ 109 | - (UIImage *)cropAtIndex:(NSUInteger)index { 110 | CGSize imageSize = [_image size]; 111 | 112 | CGRect frame = [self cropperCornerFrameFromIndex:index]; 113 | 114 | CGFloat scale = imageSize.width / [self bounds].size.width; 115 | CGRect rect = frame; 116 | rect.origin.x *= scale; 117 | rect.origin.y *= scale; 118 | rect.size.width *= scale; 119 | rect.size.height *= scale; 120 | 121 | UIGraphicsBeginImageContext(rect.size); 122 | CGContextRef context = UIGraphicsGetCurrentContext(); 123 | CGContextClipToRect(context, CGRectMake(0.0f, 0.0f, CGRectGetWidth(rect), CGRectGetHeight(rect))); 124 | [_image drawInRect:CGRectMake(-CGRectGetMinX(rect), -CGRectGetMinY(rect), imageSize.width, imageSize.height)]; 125 | 126 | UIImage * result = UIGraphicsGetImageFromCurrentImageContext(); 127 | UIGraphicsEndImageContext(); 128 | 129 | return result; 130 | } 131 | 132 | /** 133 | 모든 코너 세트들을 이용하여 Crop Image List를 반환하는 메소드 134 | @return NSArray UIImage List 135 | */ 136 | - (NSArray *)crop { 137 | NSMutableArray * result = [NSMutableArray arrayWithCapacity:[self count]]; 138 | 139 | for (NSUInteger i = 0, cnt = [self count]; i < cnt; i++) { 140 | [result addObject:[self cropAtIndex:i]]; 141 | } 142 | 143 | return result; 144 | } 145 | 146 | #pragma mark - 147 | #pragma mark UIGestureRecognizer 148 | - (void)panGestureRecognizer:(UIPanGestureRecognizer *)sender { 149 | CGPoint point = [sender locationInView:[sender view]]; 150 | static NSInteger cropperIndex = kCropperIndexDefault; 151 | 152 | switch ([sender state]) { 153 | case UIGestureRecognizerStateBegan: { 154 | cropperIndex = [_cropperCornerManager cornerIndexFromCGPoint:point]; 155 | _currentCropperIndex = cropperIndex; 156 | 157 | for (id cropperCorner in [_cropperCornerManager cropperCornersWithCornerMode:CropperCornerModeAll index:cropperIndex]) { 158 | // Cropper 전체적으로 이동 준비 159 | [cropperCorner setBeganCenter]; 160 | } 161 | break; 162 | } 163 | case UIGestureRecognizerStateChanged: { 164 | if (cropperIndex == kCropperIndexDefault) { 165 | // cropper index 를 검사하여 Rect 겹치더라도 오류나지 않게 수정 166 | cropperIndex = _currentCropperIndex; 167 | } 168 | 169 | CGPoint translate = [sender translationInView:[sender view]]; 170 | for (id cropperCorner in [_cropperCornerManager cropperCornersWithCornerMode:CropperCornerModeAll index:cropperIndex]) 171 | { 172 | // Cropper 전체적으로 이동 173 | [_cropperCornerManager cropperCorner:cropperCorner translate:translate cropperCornerMode:CropperCornerModeAll]; 174 | } 175 | break; 176 | } 177 | default: 178 | cropperIndex = kCropperIndexDefault; 179 | break; 180 | } 181 | } 182 | 183 | - (void)drawRect:(CGRect)rect { 184 | [super drawRect:rect]; 185 | 186 | // 1. draw Background Image 187 | CGSize imageSize = [_image size]; 188 | CGSize viewSize = [self bounds].size; 189 | 190 | CGFloat hfactor = imageSize.width / viewSize.width; 191 | CGFloat vfactor = imageSize.height / viewSize.height; 192 | 193 | CGFloat factor = fmax(hfactor, vfactor); 194 | 195 | CGFloat newWidth = imageSize.width / factor; 196 | CGFloat newHeight = imageSize.height / factor; 197 | 198 | CGFloat x = (viewSize.width - newWidth) / 2; 199 | CGFloat y = (viewSize.height - newHeight) / 2; 200 | CGRect newRect = CGRectMake(x, y, newWidth, newHeight); 201 | 202 | [_image drawInRect:newRect]; 203 | 204 | // 2. draw Cropper Areas 205 | CGContextRef context = UIGraphicsGetCurrentContext(); 206 | 207 | CGContextSetFillColorWithColor(context, _contentColor.CGColor); 208 | 209 | for (NSUInteger i = 0; i < [_cropperCornerManager count]; i++) { 210 | CGRect frame = [_cropperCornerManager cropperCornerFrameFromIndex:i]; 211 | CGContextAddRect(context, frame); 212 | } 213 | 214 | CGContextFillPath(context); 215 | } 216 | 217 | @end 218 | -------------------------------------------------------------------------------- /CropperView/ICropper.h: -------------------------------------------------------------------------------- 1 | // 2 | // ICropper.h 3 | // Cropper 4 | // 5 | // Created by 최 중관 on 2014. 7. 20.. 6 | // Copyright (c) 2014년 JoongKwan Choi. All rights reserved. 7 | // 8 | 9 | @protocol ICropper 10 | @required 11 | - (void)addCropper:(CGRect)cropper; 12 | - (void)removeAllCroppers; 13 | - (CGRect)cropperCornerFrameFromIndex:(NSUInteger)index; 14 | - (NSUInteger)count; 15 | @end 16 | -------------------------------------------------------------------------------- /CropperView/ICropperCorner.h: -------------------------------------------------------------------------------- 1 | // 2 | // ICropperCorner.h 3 | // Cropper 4 | // 5 | // Created by 최 중관 on 2014. 7. 20.. 6 | // Copyright (c) 2014년 JoongKwan Choi. All rights reserved. 7 | // 8 | 9 | typedef NS_ENUM(NSUInteger, CropperCornerMode) { 10 | CropperCornerModeNone = 0, 11 | CropperCornerModeLeft = 1 << 0, 12 | CropperCornerModeRight = 1 << 1, 13 | CropperCornerModeTop = 1 << 2, 14 | CropperCornerModeBottom = 1 << 3, 15 | CropperCornerModeTopLeft = 1 << 4, 16 | CropperCornerModeBottomRight = 1 << 5, 17 | CropperCornerModeAll = CropperCornerModeLeft | CropperCornerModeRight | CropperCornerModeTop | CropperCornerModeBottom 18 | }; 19 | 20 | @protocol ICropperCorner 21 | @required 22 | @property (nonatomic, unsafe_unretained) CropperCornerMode cropperCornerMode; 23 | @property (nonatomic, unsafe_unretained) NSInteger index; 24 | @property (nonatomic, unsafe_unretained) CGPoint center; 25 | 26 | - (void)setBeganCenter; 27 | - (void)setTranslate:(CGPoint)translate cropperCornerMode:(CropperCornerMode)cropperCornerMode; 28 | @end 29 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | F15D7505197ABFF70026B5BF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F15D7504197ABFF70026B5BF /* Foundation.framework */; }; 11 | F15D7507197ABFF70026B5BF /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F15D7506197ABFF70026B5BF /* CoreGraphics.framework */; }; 12 | F15D7509197ABFF70026B5BF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F15D7508197ABFF70026B5BF /* UIKit.framework */; }; 13 | F15D750F197ABFF70026B5BF /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F15D750D197ABFF70026B5BF /* InfoPlist.strings */; }; 14 | F15D7511197ABFF70026B5BF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F15D7510197ABFF70026B5BF /* main.m */; }; 15 | F15D7515197ABFF70026B5BF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F15D7514197ABFF70026B5BF /* AppDelegate.m */; }; 16 | F15D7518197ABFF70026B5BF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F15D7516197ABFF70026B5BF /* Main.storyboard */; }; 17 | F15D751B197ABFF70026B5BF /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F15D751A197ABFF70026B5BF /* ViewController.m */; }; 18 | F15D751D197ABFF70026B5BF /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F15D751C197ABFF70026B5BF /* Images.xcassets */; }; 19 | F15D7524197ABFF70026B5BF /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F15D7523197ABFF70026B5BF /* XCTest.framework */; }; 20 | F15D7525197ABFF70026B5BF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F15D7504197ABFF70026B5BF /* Foundation.framework */; }; 21 | F15D7526197ABFF70026B5BF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F15D7508197ABFF70026B5BF /* UIKit.framework */; }; 22 | F15D752E197ABFF70026B5BF /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F15D752C197ABFF70026B5BF /* InfoPlist.strings */; }; 23 | F15D7530197ABFF70026B5BF /* CropperViewDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F15D752F197ABFF70026B5BF /* CropperViewDemoTests.m */; }; 24 | F15D7546197AC2170026B5BF /* background@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F15D7545197AC2170026B5BF /* background@2x.png */; }; 25 | F15D7547197AC2170026B5BF /* background@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F15D7545197AC2170026B5BF /* background@2x.png */; }; 26 | F15D7555197ADB220026B5BF /* CropperCornerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F15D754D197ADB220026B5BF /* CropperCornerManager.m */; }; 27 | F15D7556197ADB220026B5BF /* CropperCornerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F15D754D197ADB220026B5BF /* CropperCornerManager.m */; }; 28 | F15D7557197ADB220026B5BF /* CropperCornerView.m in Sources */ = {isa = PBXBuildFile; fileRef = F15D754F197ADB220026B5BF /* CropperCornerView.m */; }; 29 | F15D7558197ADB220026B5BF /* CropperCornerView.m in Sources */ = {isa = PBXBuildFile; fileRef = F15D754F197ADB220026B5BF /* CropperCornerView.m */; }; 30 | F15D7559197ADB220026B5BF /* CropperCornerView.png in Resources */ = {isa = PBXBuildFile; fileRef = F15D7550197ADB220026B5BF /* CropperCornerView.png */; }; 31 | F15D755A197ADB220026B5BF /* CropperCornerView.png in Resources */ = {isa = PBXBuildFile; fileRef = F15D7550197ADB220026B5BF /* CropperCornerView.png */; }; 32 | F15D755B197ADB220026B5BF /* CropperView.m in Sources */ = {isa = PBXBuildFile; fileRef = F15D7552197ADB220026B5BF /* CropperView.m */; }; 33 | F15D755C197ADB220026B5BF /* CropperView.m in Sources */ = {isa = PBXBuildFile; fileRef = F15D7552197ADB220026B5BF /* CropperView.m */; }; 34 | /* End PBXBuildFile section */ 35 | 36 | /* Begin PBXContainerItemProxy section */ 37 | F15D7527197ABFF70026B5BF /* PBXContainerItemProxy */ = { 38 | isa = PBXContainerItemProxy; 39 | containerPortal = F15D74F9197ABFF70026B5BF /* Project object */; 40 | proxyType = 1; 41 | remoteGlobalIDString = F15D7500197ABFF70026B5BF; 42 | remoteInfo = CropperViewDemo; 43 | }; 44 | /* End PBXContainerItemProxy section */ 45 | 46 | /* Begin PBXFileReference section */ 47 | F15D7501197ABFF70026B5BF /* CropperViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CropperViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | F15D7504197ABFF70026B5BF /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 49 | F15D7506197ABFF70026B5BF /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 50 | F15D7508197ABFF70026B5BF /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 51 | F15D750C197ABFF70026B5BF /* CropperViewDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CropperViewDemo-Info.plist"; sourceTree = ""; }; 52 | F15D750E197ABFF70026B5BF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 53 | F15D7510197ABFF70026B5BF /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 54 | F15D7512197ABFF70026B5BF /* CropperViewDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CropperViewDemo-Prefix.pch"; sourceTree = ""; }; 55 | F15D7513197ABFF70026B5BF /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 56 | F15D7514197ABFF70026B5BF /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 57 | F15D7517197ABFF70026B5BF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 58 | F15D7519197ABFF70026B5BF /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 59 | F15D751A197ABFF70026B5BF /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 60 | F15D751C197ABFF70026B5BF /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 61 | F15D7522197ABFF70026B5BF /* CropperViewDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CropperViewDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | F15D7523197ABFF70026B5BF /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 63 | F15D752B197ABFF70026B5BF /* CropperViewDemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CropperViewDemoTests-Info.plist"; sourceTree = ""; }; 64 | F15D752D197ABFF70026B5BF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 65 | F15D752F197ABFF70026B5BF /* CropperViewDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CropperViewDemoTests.m; sourceTree = ""; }; 66 | F15D7545197AC2170026B5BF /* background@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "background@2x.png"; sourceTree = ""; }; 67 | F15D754C197ADB220026B5BF /* CropperCornerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CropperCornerManager.h; sourceTree = ""; }; 68 | F15D754D197ADB220026B5BF /* CropperCornerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CropperCornerManager.m; sourceTree = ""; }; 69 | F15D754E197ADB220026B5BF /* CropperCornerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CropperCornerView.h; sourceTree = ""; }; 70 | F15D754F197ADB220026B5BF /* CropperCornerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CropperCornerView.m; sourceTree = ""; }; 71 | F15D7550197ADB220026B5BF /* CropperCornerView.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CropperCornerView.png; sourceTree = ""; }; 72 | F15D7551197ADB220026B5BF /* CropperView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CropperView.h; sourceTree = ""; }; 73 | F15D7552197ADB220026B5BF /* CropperView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CropperView.m; sourceTree = ""; }; 74 | F15D7553197ADB220026B5BF /* ICropper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICropper.h; sourceTree = ""; }; 75 | F15D7554197ADB220026B5BF /* ICropperCorner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICropperCorner.h; sourceTree = ""; }; 76 | /* End PBXFileReference section */ 77 | 78 | /* Begin PBXFrameworksBuildPhase section */ 79 | F15D74FE197ABFF70026B5BF /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | F15D7507197ABFF70026B5BF /* CoreGraphics.framework in Frameworks */, 84 | F15D7509197ABFF70026B5BF /* UIKit.framework in Frameworks */, 85 | F15D7505197ABFF70026B5BF /* Foundation.framework in Frameworks */, 86 | ); 87 | runOnlyForDeploymentPostprocessing = 0; 88 | }; 89 | F15D751F197ABFF70026B5BF /* Frameworks */ = { 90 | isa = PBXFrameworksBuildPhase; 91 | buildActionMask = 2147483647; 92 | files = ( 93 | F15D7524197ABFF70026B5BF /* XCTest.framework in Frameworks */, 94 | F15D7526197ABFF70026B5BF /* UIKit.framework in Frameworks */, 95 | F15D7525197ABFF70026B5BF /* Foundation.framework in Frameworks */, 96 | ); 97 | runOnlyForDeploymentPostprocessing = 0; 98 | }; 99 | /* End PBXFrameworksBuildPhase section */ 100 | 101 | /* Begin PBXGroup section */ 102 | F15D74F8197ABFF70026B5BF = { 103 | isa = PBXGroup; 104 | children = ( 105 | F15D754B197ADB220026B5BF /* CropperView */, 106 | F15D750A197ABFF70026B5BF /* CropperViewDemo */, 107 | F15D7529197ABFF70026B5BF /* CropperViewDemoTests */, 108 | F15D7503197ABFF70026B5BF /* Frameworks */, 109 | F15D7502197ABFF70026B5BF /* Products */, 110 | ); 111 | sourceTree = ""; 112 | }; 113 | F15D7502197ABFF70026B5BF /* Products */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | F15D7501197ABFF70026B5BF /* CropperViewDemo.app */, 117 | F15D7522197ABFF70026B5BF /* CropperViewDemoTests.xctest */, 118 | ); 119 | name = Products; 120 | sourceTree = ""; 121 | }; 122 | F15D7503197ABFF70026B5BF /* Frameworks */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | F15D7504197ABFF70026B5BF /* Foundation.framework */, 126 | F15D7506197ABFF70026B5BF /* CoreGraphics.framework */, 127 | F15D7508197ABFF70026B5BF /* UIKit.framework */, 128 | F15D7523197ABFF70026B5BF /* XCTest.framework */, 129 | ); 130 | name = Frameworks; 131 | sourceTree = ""; 132 | }; 133 | F15D750A197ABFF70026B5BF /* CropperViewDemo */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | F15D7513197ABFF70026B5BF /* AppDelegate.h */, 137 | F15D7514197ABFF70026B5BF /* AppDelegate.m */, 138 | F15D7516197ABFF70026B5BF /* Main.storyboard */, 139 | F15D7519197ABFF70026B5BF /* ViewController.h */, 140 | F15D751A197ABFF70026B5BF /* ViewController.m */, 141 | F15D7545197AC2170026B5BF /* background@2x.png */, 142 | F15D751C197ABFF70026B5BF /* Images.xcassets */, 143 | F15D750B197ABFF70026B5BF /* Supporting Files */, 144 | ); 145 | path = CropperViewDemo; 146 | sourceTree = ""; 147 | }; 148 | F15D750B197ABFF70026B5BF /* Supporting Files */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | F15D750C197ABFF70026B5BF /* CropperViewDemo-Info.plist */, 152 | F15D750D197ABFF70026B5BF /* InfoPlist.strings */, 153 | F15D7510197ABFF70026B5BF /* main.m */, 154 | F15D7512197ABFF70026B5BF /* CropperViewDemo-Prefix.pch */, 155 | ); 156 | name = "Supporting Files"; 157 | sourceTree = ""; 158 | }; 159 | F15D7529197ABFF70026B5BF /* CropperViewDemoTests */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | F15D752F197ABFF70026B5BF /* CropperViewDemoTests.m */, 163 | F15D752A197ABFF70026B5BF /* Supporting Files */, 164 | ); 165 | path = CropperViewDemoTests; 166 | sourceTree = ""; 167 | }; 168 | F15D752A197ABFF70026B5BF /* Supporting Files */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | F15D752B197ABFF70026B5BF /* CropperViewDemoTests-Info.plist */, 172 | F15D752C197ABFF70026B5BF /* InfoPlist.strings */, 173 | ); 174 | name = "Supporting Files"; 175 | sourceTree = ""; 176 | }; 177 | F15D754B197ADB220026B5BF /* CropperView */ = { 178 | isa = PBXGroup; 179 | children = ( 180 | F15D754C197ADB220026B5BF /* CropperCornerManager.h */, 181 | F15D754D197ADB220026B5BF /* CropperCornerManager.m */, 182 | F15D754E197ADB220026B5BF /* CropperCornerView.h */, 183 | F15D754F197ADB220026B5BF /* CropperCornerView.m */, 184 | F15D7550197ADB220026B5BF /* CropperCornerView.png */, 185 | F15D7551197ADB220026B5BF /* CropperView.h */, 186 | F15D7552197ADB220026B5BF /* CropperView.m */, 187 | F15D7553197ADB220026B5BF /* ICropper.h */, 188 | F15D7554197ADB220026B5BF /* ICropperCorner.h */, 189 | ); 190 | name = CropperView; 191 | path = ../CropperView; 192 | sourceTree = ""; 193 | }; 194 | /* End PBXGroup section */ 195 | 196 | /* Begin PBXNativeTarget section */ 197 | F15D7500197ABFF70026B5BF /* CropperViewDemo */ = { 198 | isa = PBXNativeTarget; 199 | buildConfigurationList = F15D7533197ABFF70026B5BF /* Build configuration list for PBXNativeTarget "CropperViewDemo" */; 200 | buildPhases = ( 201 | F15D74FD197ABFF70026B5BF /* Sources */, 202 | F15D74FE197ABFF70026B5BF /* Frameworks */, 203 | F15D74FF197ABFF70026B5BF /* Resources */, 204 | ); 205 | buildRules = ( 206 | ); 207 | dependencies = ( 208 | ); 209 | name = CropperViewDemo; 210 | productName = CropperViewDemo; 211 | productReference = F15D7501197ABFF70026B5BF /* CropperViewDemo.app */; 212 | productType = "com.apple.product-type.application"; 213 | }; 214 | F15D7521197ABFF70026B5BF /* CropperViewDemoTests */ = { 215 | isa = PBXNativeTarget; 216 | buildConfigurationList = F15D7536197ABFF70026B5BF /* Build configuration list for PBXNativeTarget "CropperViewDemoTests" */; 217 | buildPhases = ( 218 | F15D751E197ABFF70026B5BF /* Sources */, 219 | F15D751F197ABFF70026B5BF /* Frameworks */, 220 | F15D7520197ABFF70026B5BF /* Resources */, 221 | ); 222 | buildRules = ( 223 | ); 224 | dependencies = ( 225 | F15D7528197ABFF70026B5BF /* PBXTargetDependency */, 226 | ); 227 | name = CropperViewDemoTests; 228 | productName = CropperViewDemoTests; 229 | productReference = F15D7522197ABFF70026B5BF /* CropperViewDemoTests.xctest */; 230 | productType = "com.apple.product-type.bundle.unit-test"; 231 | }; 232 | /* End PBXNativeTarget section */ 233 | 234 | /* Begin PBXProject section */ 235 | F15D74F9197ABFF70026B5BF /* Project object */ = { 236 | isa = PBXProject; 237 | attributes = { 238 | LastUpgradeCheck = 0510; 239 | ORGANIZATIONNAME = "JoongKwan Choi"; 240 | TargetAttributes = { 241 | F15D7521197ABFF70026B5BF = { 242 | TestTargetID = F15D7500197ABFF70026B5BF; 243 | }; 244 | }; 245 | }; 246 | buildConfigurationList = F15D74FC197ABFF70026B5BF /* Build configuration list for PBXProject "CropperViewDemo" */; 247 | compatibilityVersion = "Xcode 3.2"; 248 | developmentRegion = English; 249 | hasScannedForEncodings = 0; 250 | knownRegions = ( 251 | en, 252 | Base, 253 | ); 254 | mainGroup = F15D74F8197ABFF70026B5BF; 255 | productRefGroup = F15D7502197ABFF70026B5BF /* Products */; 256 | projectDirPath = ""; 257 | projectRoot = ""; 258 | targets = ( 259 | F15D7500197ABFF70026B5BF /* CropperViewDemo */, 260 | F15D7521197ABFF70026B5BF /* CropperViewDemoTests */, 261 | ); 262 | }; 263 | /* End PBXProject section */ 264 | 265 | /* Begin PBXResourcesBuildPhase section */ 266 | F15D74FF197ABFF70026B5BF /* Resources */ = { 267 | isa = PBXResourcesBuildPhase; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | F15D751D197ABFF70026B5BF /* Images.xcassets in Resources */, 271 | F15D750F197ABFF70026B5BF /* InfoPlist.strings in Resources */, 272 | F15D7518197ABFF70026B5BF /* Main.storyboard in Resources */, 273 | F15D7559197ADB220026B5BF /* CropperCornerView.png in Resources */, 274 | F15D7546197AC2170026B5BF /* background@2x.png in Resources */, 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | }; 278 | F15D7520197ABFF70026B5BF /* Resources */ = { 279 | isa = PBXResourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | F15D7547197AC2170026B5BF /* background@2x.png in Resources */, 283 | F15D752E197ABFF70026B5BF /* InfoPlist.strings in Resources */, 284 | F15D755A197ADB220026B5BF /* CropperCornerView.png in Resources */, 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | }; 288 | /* End PBXResourcesBuildPhase section */ 289 | 290 | /* Begin PBXSourcesBuildPhase section */ 291 | F15D74FD197ABFF70026B5BF /* Sources */ = { 292 | isa = PBXSourcesBuildPhase; 293 | buildActionMask = 2147483647; 294 | files = ( 295 | F15D7557197ADB220026B5BF /* CropperCornerView.m in Sources */, 296 | F15D7555197ADB220026B5BF /* CropperCornerManager.m in Sources */, 297 | F15D751B197ABFF70026B5BF /* ViewController.m in Sources */, 298 | F15D7515197ABFF70026B5BF /* AppDelegate.m in Sources */, 299 | F15D755B197ADB220026B5BF /* CropperView.m in Sources */, 300 | F15D7511197ABFF70026B5BF /* main.m in Sources */, 301 | ); 302 | runOnlyForDeploymentPostprocessing = 0; 303 | }; 304 | F15D751E197ABFF70026B5BF /* Sources */ = { 305 | isa = PBXSourcesBuildPhase; 306 | buildActionMask = 2147483647; 307 | files = ( 308 | F15D7556197ADB220026B5BF /* CropperCornerManager.m in Sources */, 309 | F15D7530197ABFF70026B5BF /* CropperViewDemoTests.m in Sources */, 310 | F15D755C197ADB220026B5BF /* CropperView.m in Sources */, 311 | F15D7558197ADB220026B5BF /* CropperCornerView.m in Sources */, 312 | ); 313 | runOnlyForDeploymentPostprocessing = 0; 314 | }; 315 | /* End PBXSourcesBuildPhase section */ 316 | 317 | /* Begin PBXTargetDependency section */ 318 | F15D7528197ABFF70026B5BF /* PBXTargetDependency */ = { 319 | isa = PBXTargetDependency; 320 | target = F15D7500197ABFF70026B5BF /* CropperViewDemo */; 321 | targetProxy = F15D7527197ABFF70026B5BF /* PBXContainerItemProxy */; 322 | }; 323 | /* End PBXTargetDependency section */ 324 | 325 | /* Begin PBXVariantGroup section */ 326 | F15D750D197ABFF70026B5BF /* InfoPlist.strings */ = { 327 | isa = PBXVariantGroup; 328 | children = ( 329 | F15D750E197ABFF70026B5BF /* en */, 330 | ); 331 | name = InfoPlist.strings; 332 | sourceTree = ""; 333 | }; 334 | F15D7516197ABFF70026B5BF /* Main.storyboard */ = { 335 | isa = PBXVariantGroup; 336 | children = ( 337 | F15D7517197ABFF70026B5BF /* Base */, 338 | ); 339 | name = Main.storyboard; 340 | sourceTree = ""; 341 | }; 342 | F15D752C197ABFF70026B5BF /* InfoPlist.strings */ = { 343 | isa = PBXVariantGroup; 344 | children = ( 345 | F15D752D197ABFF70026B5BF /* en */, 346 | ); 347 | name = InfoPlist.strings; 348 | sourceTree = ""; 349 | }; 350 | /* End PBXVariantGroup section */ 351 | 352 | /* Begin XCBuildConfiguration section */ 353 | F15D7531197ABFF70026B5BF /* Debug */ = { 354 | isa = XCBuildConfiguration; 355 | buildSettings = { 356 | ALWAYS_SEARCH_USER_PATHS = NO; 357 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 358 | CLANG_CXX_LIBRARY = "libc++"; 359 | CLANG_ENABLE_MODULES = YES; 360 | CLANG_ENABLE_OBJC_ARC = YES; 361 | CLANG_WARN_BOOL_CONVERSION = YES; 362 | CLANG_WARN_CONSTANT_CONVERSION = YES; 363 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 364 | CLANG_WARN_EMPTY_BODY = YES; 365 | CLANG_WARN_ENUM_CONVERSION = YES; 366 | CLANG_WARN_INT_CONVERSION = YES; 367 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 368 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 369 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 370 | COPY_PHASE_STRIP = NO; 371 | GCC_C_LANGUAGE_STANDARD = gnu99; 372 | GCC_DYNAMIC_NO_PIC = NO; 373 | GCC_OPTIMIZATION_LEVEL = 0; 374 | GCC_PREPROCESSOR_DEFINITIONS = ( 375 | "DEBUG=1", 376 | "$(inherited)", 377 | ); 378 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 379 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 380 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 381 | GCC_WARN_UNDECLARED_SELECTOR = YES; 382 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 383 | GCC_WARN_UNUSED_FUNCTION = YES; 384 | GCC_WARN_UNUSED_VARIABLE = YES; 385 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 386 | ONLY_ACTIVE_ARCH = YES; 387 | SDKROOT = iphoneos; 388 | }; 389 | name = Debug; 390 | }; 391 | F15D7532197ABFF70026B5BF /* Release */ = { 392 | isa = XCBuildConfiguration; 393 | buildSettings = { 394 | ALWAYS_SEARCH_USER_PATHS = NO; 395 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 396 | CLANG_CXX_LIBRARY = "libc++"; 397 | CLANG_ENABLE_MODULES = YES; 398 | CLANG_ENABLE_OBJC_ARC = YES; 399 | CLANG_WARN_BOOL_CONVERSION = YES; 400 | CLANG_WARN_CONSTANT_CONVERSION = YES; 401 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 402 | CLANG_WARN_EMPTY_BODY = YES; 403 | CLANG_WARN_ENUM_CONVERSION = YES; 404 | CLANG_WARN_INT_CONVERSION = YES; 405 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 406 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 407 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 408 | COPY_PHASE_STRIP = YES; 409 | ENABLE_NS_ASSERTIONS = NO; 410 | GCC_C_LANGUAGE_STANDARD = gnu99; 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 418 | SDKROOT = iphoneos; 419 | VALIDATE_PRODUCT = YES; 420 | }; 421 | name = Release; 422 | }; 423 | F15D7534197ABFF70026B5BF /* Debug */ = { 424 | isa = XCBuildConfiguration; 425 | buildSettings = { 426 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 427 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 428 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 429 | GCC_PREFIX_HEADER = "CropperViewDemo/CropperViewDemo-Prefix.pch"; 430 | INFOPLIST_FILE = "CropperViewDemo/CropperViewDemo-Info.plist"; 431 | PRODUCT_NAME = "$(TARGET_NAME)"; 432 | WRAPPER_EXTENSION = app; 433 | }; 434 | name = Debug; 435 | }; 436 | F15D7535197ABFF70026B5BF /* Release */ = { 437 | isa = XCBuildConfiguration; 438 | buildSettings = { 439 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 440 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 441 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 442 | GCC_PREFIX_HEADER = "CropperViewDemo/CropperViewDemo-Prefix.pch"; 443 | INFOPLIST_FILE = "CropperViewDemo/CropperViewDemo-Info.plist"; 444 | PRODUCT_NAME = "$(TARGET_NAME)"; 445 | WRAPPER_EXTENSION = app; 446 | }; 447 | name = Release; 448 | }; 449 | F15D7537197ABFF70026B5BF /* Debug */ = { 450 | isa = XCBuildConfiguration; 451 | buildSettings = { 452 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CropperViewDemo.app/CropperViewDemo"; 453 | FRAMEWORK_SEARCH_PATHS = ( 454 | "$(SDKROOT)/Developer/Library/Frameworks", 455 | "$(inherited)", 456 | "$(DEVELOPER_FRAMEWORKS_DIR)", 457 | ); 458 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 459 | GCC_PREFIX_HEADER = "CropperViewDemo/CropperViewDemo-Prefix.pch"; 460 | GCC_PREPROCESSOR_DEFINITIONS = ( 461 | "DEBUG=1", 462 | "$(inherited)", 463 | ); 464 | INFOPLIST_FILE = "CropperViewDemoTests/CropperViewDemoTests-Info.plist"; 465 | PRODUCT_NAME = "$(TARGET_NAME)"; 466 | TEST_HOST = "$(BUNDLE_LOADER)"; 467 | WRAPPER_EXTENSION = xctest; 468 | }; 469 | name = Debug; 470 | }; 471 | F15D7538197ABFF70026B5BF /* Release */ = { 472 | isa = XCBuildConfiguration; 473 | buildSettings = { 474 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CropperViewDemo.app/CropperViewDemo"; 475 | FRAMEWORK_SEARCH_PATHS = ( 476 | "$(SDKROOT)/Developer/Library/Frameworks", 477 | "$(inherited)", 478 | "$(DEVELOPER_FRAMEWORKS_DIR)", 479 | ); 480 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 481 | GCC_PREFIX_HEADER = "CropperViewDemo/CropperViewDemo-Prefix.pch"; 482 | INFOPLIST_FILE = "CropperViewDemoTests/CropperViewDemoTests-Info.plist"; 483 | PRODUCT_NAME = "$(TARGET_NAME)"; 484 | TEST_HOST = "$(BUNDLE_LOADER)"; 485 | WRAPPER_EXTENSION = xctest; 486 | }; 487 | name = Release; 488 | }; 489 | /* End XCBuildConfiguration section */ 490 | 491 | /* Begin XCConfigurationList section */ 492 | F15D74FC197ABFF70026B5BF /* Build configuration list for PBXProject "CropperViewDemo" */ = { 493 | isa = XCConfigurationList; 494 | buildConfigurations = ( 495 | F15D7531197ABFF70026B5BF /* Debug */, 496 | F15D7532197ABFF70026B5BF /* Release */, 497 | ); 498 | defaultConfigurationIsVisible = 0; 499 | defaultConfigurationName = Release; 500 | }; 501 | F15D7533197ABFF70026B5BF /* Build configuration list for PBXNativeTarget "CropperViewDemo" */ = { 502 | isa = XCConfigurationList; 503 | buildConfigurations = ( 504 | F15D7534197ABFF70026B5BF /* Debug */, 505 | F15D7535197ABFF70026B5BF /* Release */, 506 | ); 507 | defaultConfigurationIsVisible = 0; 508 | defaultConfigurationName = Release; 509 | }; 510 | F15D7536197ABFF70026B5BF /* Build configuration list for PBXNativeTarget "CropperViewDemoTests" */ = { 511 | isa = XCConfigurationList; 512 | buildConfigurations = ( 513 | F15D7537197ABFF70026B5BF /* Debug */, 514 | F15D7538197ABFF70026B5BF /* Release */, 515 | ); 516 | defaultConfigurationIsVisible = 0; 517 | defaultConfigurationName = Release; 518 | }; 519 | /* End XCConfigurationList section */ 520 | }; 521 | rootObject = F15D74F9197ABFF70026B5BF /* Project object */; 522 | } 523 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo.xcodeproj/project.xcworkspace/xcshareddata/CropperViewDemo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | EC2D98A8-72E1-4804-B125-2C2AA9CCDE4B 9 | IDESourceControlProjectName 10 | CropperViewDemo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 621585744C5B6135947E68DB92E85571C7553817 14 | https://github.com/tiny2n/CropperView.git 15 | 16 | IDESourceControlProjectPath 17 | CropperViewDemo/CropperViewDemo.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 621585744C5B6135947E68DB92E85571C7553817 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/tiny2n/CropperView.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 621585744C5B6135947E68DB92E85571C7553817 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 621585744C5B6135947E68DB92E85571C7553817 36 | IDESourceControlWCCName 37 | CropperView 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo.xcodeproj/project.xcworkspace/xcuserdata/IM050.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tiny2n/CropperView/01bbe49bd3d4f9040b9a760377219331941fa100/CropperViewDemo/CropperViewDemo.xcodeproj/project.xcworkspace/xcuserdata/IM050.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo.xcodeproj/project.xcworkspace/xcuserdata/tiny2n.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tiny2n/CropperView/01bbe49bd3d4f9040b9a760377219331941fa100/CropperViewDemo/CropperViewDemo.xcodeproj/project.xcworkspace/xcuserdata/tiny2n.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo.xcodeproj/xcuserdata/IM050.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo.xcodeproj/xcuserdata/IM050.xcuserdatad/xcschemes/CropperViewDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo.xcodeproj/xcuserdata/IM050.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CropperViewDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | F15D7500197ABFF70026B5BF 16 | 17 | primary 18 | 19 | 20 | F15D7521197ABFF70026B5BF 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo.xcodeproj/xcuserdata/tiny2n.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo.xcodeproj/xcuserdata/tiny2n.xcuserdatad/xcschemes/CropperViewDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo.xcodeproj/xcuserdata/tiny2n.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CropperViewDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | F15D7500197ABFF70026B5BF 16 | 17 | primary 18 | 19 | 20 | F15D7521197ABFF70026B5BF 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CropperViewDemo 4 | // 5 | // Created by 최 중관 on 2014. 7. 20.. 6 | // Copyright (c) 2014년 JoongKwan Choi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CropperViewDemo 4 | // 5 | // Created by 최 중관 on 2014. 7. 20.. 6 | // Copyright (c) 2014년 JoongKwan Choi. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo/CropperViewDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | tiny2n.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo/CropperViewDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CropperViewDemo 4 | // 5 | // Created by 최 중관 on 2014. 7. 20.. 6 | // Copyright (c) 2014년 JoongKwan Choi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CropperViewDemo 4 | // 5 | // Created by 최 중관 on 2014. 7. 20.. 6 | // Copyright (c) 2014년 JoongKwan Choi. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | #import "CropperView.h" 12 | 13 | @interface ViewController () 14 | 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad 20 | { 21 | [super viewDidLoad]; 22 | // Do any additional setup after loading the view, typically from a nib. 23 | 24 | CropperView * cropperView = [[CropperView alloc] initWithFrame:self.view.bounds]; 25 | [cropperView setImage:[UIImage imageNamed:@"background@2x.png"]]; 26 | 27 | [cropperView addCropper:CGRectMake(40, 40, 100, 100)]; 28 | [cropperView addCropper:CGRectMake(150, 150, 100, 100)]; 29 | [self.view addSubview:cropperView]; 30 | } 31 | 32 | - (void)didReceiveMemoryWarning 33 | { 34 | [super didReceiveMemoryWarning]; 35 | // Dispose of any resources that can be recreated. 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo/background@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tiny2n/CropperView/01bbe49bd3d4f9040b9a760377219331941fa100/CropperViewDemo/CropperViewDemo/background@2x.png -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CropperViewDemo 4 | // 5 | // Created by 최 중관 on 2014. 7. 20.. 6 | // Copyright (c) 2014년 JoongKwan Choi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemoTests/CropperViewDemoTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | tiny2n.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemoTests/CropperViewDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CropperViewDemoTests.m 3 | // CropperViewDemoTests 4 | // 5 | // Created by 최 중관 on 2014. 7. 20.. 6 | // Copyright (c) 2014년 JoongKwan Choi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CropperViewDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation CropperViewDemoTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /CropperViewDemo/CropperViewDemoTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 JoongKwan Choi 4 | 5 | JKLib 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CropperView 2 | ============= 3 | 4 | It is Cropper View Control. 5 | 6 | You can support multiple rect areas. 7 | You can move each of corners. 8 | You can move each of croppers. 9 | You can crop. 10 | 11 | 12 | ### Installation 13 | Add the files to your project manually by dragging the CropperView directory into your Xcode project. 14 | 15 | 16 | ### Usage 17 | 18 | ``` 19 | // Import the class 20 | #import "CropperView.h" 21 | 22 | ... 23 | 24 | // --------------------------------------------------- 25 | // ex) get CropperView in UIViewController or UIView or ... 26 | // --------------------------------------------------- 27 | // add UIViewController 28 | CropperView * cropperView = [[CropperView alloc] initWithFrame:self.view.bounds]; 29 | [cropperView addCropper:CGRectMake(10, 10, 100, 100)]; // <- add rect {{10, 10}, {100, 100}} 30 | [cropperView addCropper:CGRectMake(130, 130, 100, 100)]; // <- if you want multily rect, add rect 31 | [self.view addSubview:cropperView]; 32 | 33 | ... 34 | 35 | // --------------------------------------------------- 36 | // ex) crop image by Rect of CopperView 37 | // --------------------------------------------------- 38 | UIImage * image = [cropperView cropAtIndex:0]; // as multiple Cropper Mode, get image object with particular index 39 | // or 40 | NSArray * images = [cropperView crop]; // get image list Cropper's (all image) 41 | 42 | ... 43 | 44 | ``` 45 | 46 | ![DropAlert](https://github.com/tiny2n/CropperView/blob/master/Screenshot.png) 47 | 48 | 49 | ## Contact 50 | 51 | Follow tiny2n on Twitter ([@tiny2n](https://twitter.com/tiny2n)) 52 | 53 | 54 | ### thanks 55 | 56 | - [AlexanderZubkov](https://github.com/AlexanderZubkov) 57 | 58 | License 59 | ------------------------------------------------------- 60 | The MIT License (MIT) 61 | 62 | Copyright (c) 2014 JoongKwan Choi 63 | 64 | JKLib 65 | 66 | Permission is hereby granted, free of charge, to any person obtaining a copy 67 | of this software and associated documentation files (the "Software"), to deal 68 | in the Software without restriction, including without limitation the rights 69 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 70 | copies of the Software, and to permit persons to whom the Software is 71 | furnished to do so, subject to the following conditions: 72 | 73 | The above copyright notice and this permission notice shall be included in all 74 | copies or substantial portions of the Software. 75 | 76 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 77 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 78 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 79 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 80 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 81 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 82 | SOFTWARE. 83 | 84 | -------------------------------------------------------------------------------- /Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tiny2n/CropperView/01bbe49bd3d4f9040b9a760377219331941fa100/Screenshot.png --------------------------------------------------------------------------------