diff --git a/ImageCropView/ImageCropView.h b/ImageCropView/ImageCropView.h index 11cdff9..360bf98 100644 --- a/ImageCropView/ImageCropView.h +++ b/ImageCropView/ImageCropView.h @@ -71,7 +71,7 @@ typedef struct { UIView* dragViewOne; UIView* dragViewTwo; } -- (id)initWithFrame:(CGRect)frame blurOn:(BOOL)blurOn; +- (id)initWithFrame:(CGRect)frame blurOn:(BOOL)blurOn pointSize:(CGFloat)pointSize; - (void)setImage:(UIImage*)image; @property (nonatomic) CGFloat controlPointSize; @@ -100,6 +100,7 @@ typedef struct { } @property (nonatomic, weak) id delegate; @property (nonatomic) BOOL blurredBackground; +@property (nonatomic) CGFloat pointSize; @property (nonatomic, retain) UIImage* image; @property (nonatomic, retain) ImageCropView* cropView; diff --git a/ImageCropView/ImageCropView.m b/ImageCropView/ImageCropView.m index 5e148bd..a1be0d0 100755 --- a/ImageCropView/ImageCropView.m +++ b/ImageCropView/ImageCropView.m @@ -53,7 +53,7 @@ - (void)viewDidLoad action:@selector(done:)]; CGSize statusBarSize = [[UIApplication sharedApplication] statusBarFrame].size; CGRect view = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - [[self navigationController] navigationBar].bounds.size.height - statusBarSize.height); - self.cropView = [[ImageCropView alloc] initWithFrame:view blurOn:self.blurredBackground]; + self.cropView = [[ImageCropView alloc] initWithFrame:view blurOn:self.blurredBackground pointSize:self.pointSize]; self.view = contentView; [contentView addSubview:cropView]; [cropView setImage:self.image]; @@ -210,11 +210,15 @@ - (id)initWithFrame:(CGRect)frame return self; } -- (id)initWithFrame:(CGRect)frame blurOn:(BOOL)blurOn +- (id)initWithFrame:(CGRect)frame blurOn:(BOOL)blurOn pointSize:(CGFloat)pointSize { self = [super initWithFrame:frame]; if (self) { self.blurred = blurOn; + controlPointSize = DEFAULT_CONTROL_POINT_SIZE; + if (pointSize != 0) { + controlPointSize = pointSize; + } [self initViews]; } return self; @@ -237,9 +241,9 @@ - (void)initViews { imageView = [[UIImageView alloc] initWithFrame:subviewFrame]; //control points - controlPointSize = DEFAULT_CONTROL_POINT_SIZE; int initialClearAreaSize = self.frame.size.width / 5; CGPoint centerInView = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2); + NSLog(@"%f", controlPointSize); topLeftPoint = [self createControlPointAt:SquareCGRectAtCenter(centerInView.x - initialClearAreaSize, centerInView.y - initialClearAreaSize, controlPointSize)]; diff --git a/ImageCropView/ViewController.m b/ImageCropView/ViewController.m index e09ab00..809681c 100644 --- a/ImageCropView/ViewController.m +++ b/ImageCropView/ViewController.m @@ -63,6 +63,7 @@ - (IBAction)cropBarButtonClick:(id)sender { ImageCropViewController *controller = [[ImageCropViewController alloc] initWithImage:image]; controller.delegate = self; controller.blurredBackground = YES; + controller.pointSize = 9.5; [[self navigationController] pushViewController:controller animated:YES]; } } diff --git a/README.md b/README.md index 8fa9a7e..8f34e72 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,11 @@ Using FXBlurView, you can now blur the parts of the image outside the crop area. ``` objective-c controller.blurredBackground = YES; ``` +### Override control point size +Default point size is 5.0 . If you want to override it, you can do +``` objective-c +controller.pointSize = 9.5; +``` ### Minimum Image Size To set the minimum height and width of a cropped image, simply change the `IMAGE_MIN_HEIGHT` and `IMAGE_MIN_WIDTH` variables at the top of `ImageCropView.m`.