我正在使用Allowsedditing裁剪我在应用中拍摄的照片但由于它反弹而无效。有没有去做这个任务?我被告知我应该使用GKIIMagePicker,但它不起作用。我该怎么做?
- (IBAction)takePhoto:(UIButton *)sender {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
self.imagePicker = [[GKImagePicker alloc] init];
self.imagePicker.cropSize = CGSizeMake(320, 90);
self.imagePicker.delegate = self;
self.imagePicker.imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:self.imagePicker.imagePickerController animated:YES];
}
答案 0 :(得分:0)
这有效:
UIImage *image = [UIImage imageNamed:@"myImage"];
NSData *data = UIImageJPEGRepresentation(image, 1.0);
//reduce size of image (scale down)
UIImage *image2 = [UIImage imageWithData:data scale:2.0];
//increase size of image (scale up)
UIImage *image3 = [UIImage imageWithData:data scale:0.5];
指定您自己的CGFloat
值作为裁剪比例。