0

我正在使用 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];

}
4

1 回答 1

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值指定为要裁剪的比例。

于 2013-07-25T14:50:43.170 回答