TKImageView
An easy way to crop an image.
##Features
- Both iPhone/iPad available
- Support pinch gesture to zoom
- Support pan gesture to move&resize
- Support cutomize line width and color
- Support cross line and middle line
##System requirements
- iOS 7.0 or higher
cornerBorderInImage = YES
cornerBorderInImage = NO
Usage
TKImageView support both initWithFrame and initWithCoder to initialize. The properties should be set or keep default after the initialize.Once one property has been set, you should not change it any more.
@property (weak, nonatomic) IBOutlet TKImageView *tkImageView;
- (void)viewDidLoad {
_tkImageView.toCropImage = [UIImage imageNamed: @"test.jpg"];
_tkImageView.showMidLines = YES;
_tkImageView.needScaleCrop = YES;
_tkImageView.showCrossLines = YES;
_tkImageView.cornerBorderInImage = NO;
_tkImageView.cropAreaCornerWidth = 44;
_tkImageView.cropAreaCornerHeight = 44;
_tkImageView.minSpace = 30;
_tkImageView.cropAreaCornerLineColor = [UIColor whiteColor];
_tkImageView.cropAreaBorderLineColor = [UIColor whiteColor];
_tkImageView.cropAreaCornerLineWidth = 8;
_tkImageView.cropAreaBorderLineWidth = 6;
_tkImageView.cropAreaMidLineWidth = 30;
_tkImageView.cropAreaMidLineHeight = 8;
_tkImageView.cropAreaMidLineColor = [UIColor whiteColor];
_tkImageView.cropAreaCrossLineColor = [UIColor whiteColor];
_tkImageView.cropAreaCrossLineWidth = 6;
}
Function
You can get the cropped image by this function.
- (UIImage *)currentCroppedImage;
Bug&Feature Report
If you find any bugs in my code or you think it is useful to add some features in this tool, please write a issue or mail to me [email protected], thanks a lot!