Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>i am not sure this will help you or not but as you talking about cropping images so i crop image in ImagePickerView with following code I am not sure this will help you or not </p> <pre><code>- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { self.lastChosenMediaType = [info objectForKey:UIImagePickerControllerMediaType]; if ([lastChosenMediaType isEqual:(NSString *)kUTTypeImage]) { UIImage *chosenImage = [info objectForKey:UIImagePickerControllerEditedImage]; UIImage *shrunkenImage = shrinkImage(chosenImage, imageFrame.size); self.imagee = shrunkenImage; selectImage.image = imagee; } [picker dismissModalViewControllerAnimated:YES]; } - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { [picker dismissModalViewControllerAnimated:YES]; } // function for cropping images you can do some changes in parameter as per your requirements static UIImage *shrinkImage(UIImage *original, CGSize size) { CGFloat scale = [UIScreen mainScreen].scale; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, size.width * scale, size.height * scale, 8, 0, colorSpace, kCGImageAlphaPremultipliedFirst); CGContextDrawImage(context, CGRectMake(0, 0, size.width * scale, size.height * scale), original.CGImage); CGImageRef shrunken = CGBitmapContextCreateImage(context); UIImage *final = [UIImage imageWithCGImage:shrunken]; CGContextRelease(context); CGImageRelease(shrunken); return final; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload