0
在我的應用程序中,用戶可以使用下面的代碼從庫中選擇一張照片。因爲我希望用戶裁剪照片,所以我確保setAllowsEditing:YES。庫中的照片不會移動和縮放
當您選擇照片時,您可以移動和縮放圖像,但稍後當圖像被查看(selectedImage)時,圖像會恢復到其原始大小?
myPicker = [[UIImagePickerController alloc] init];
[myPicker setSourceType: UIImagePickerControllerSourceTypePhotoLibrary];
[myPicker setToolbarHidden:NO];
[myPicker setAllowsEditing:YES];
myPicker.delegate = self;
//this adds mypicker to current view
[self presentViewController:myPicker animated:YES completion:NULL];
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
selectedImage = [[UIImage alloc]init];
selectedImage = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
是的,工作! - 非常感謝你 – pete