Reputation: 1
Im new to cropping images in Xcode, and in my app I take a picture, and put that picture into a uiimage that is in a circler form. What I want to do is zoom in or move the image while the image is in the circler view then save it to the final uiimage. What I have so far is
CALayer *imageLayer= imageView.layer;
imageView.layer.cornerRadius =imageView.frame.size.height/2;
[imageLayer setBorderWidth:.5];
[imageLayer setMasksToBounds:YES];
[self.view addSubview:imageView];
Please help as soon as possible! Im so confused.
Upvotes: 0
Views: 470
Reputation: 17053
Following code creates subimage from rect
rectangle of your_image
with zooming parameter scale
CGImageRef imageRef = CGImageCreateWithImageInRect([your_image CGImage], rect);
UIImage *subImage = [UIImage imageWithCGImage:imageRef scale:scale orientation:your_image.imageOrientation];
CGImageRelease(imageRef);
Upvotes: 1