2010-10-21 57 views
1

我正在一個模塊,我需要從照片庫中挑選圖像,並在view.draw上繪圖,但每當我選擇大規模圖像它總是會返回我640 * 480縮放圖像和因爲那個小圖像被顯示。從照片庫分辨率的圖像總是640 * 480

我開啓了AllowEditing。

任何人都可以幫助我找到原始圖像的分辨率,以便我可以再次將其縮放到原始圖像。

iImagePicker.allowsImageEditing = YES; 

- (void)imagePickerController:(UIImagePickerController *)picker 
     didFinishPickingImage:(UIImage *)image 
        editingInfo:(NSDictionary *)editingInfo 
{ 

    [[iImagePicker parentViewController] dismissModalViewControllerAnimated:YES]; 
    iIsImageSaved = YES; 
    iSavedImage = [editingInfo objectForKey:@"UIImagePickerControllerOriginalImage"];; 
    int width,height; 
    width = iSavedImage.size.width; 
    height = iSavedImage.size.height; 

    iApp->ImagePicked(image); 
} 

感謝,

薩加爾

回答

1

你並不需要擴展你的形象回來,這應該是可用反正。檢查我的答案this question(這是一個重複的,我認爲..)


您使用的是deprecated method [更新了你的代碼的答案],嘗試imagePickerController:didFinishPickingMediaWithInfo:UIImagePickerControllerOriginalImage鍵代替。


添加的代碼片段:

-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { 
    UIImage* originalImage = [info objectForKey:UIImagePickerControllerOriginalImage]; 
    NSLog(@"Original image width: %f and height: %f", originalImage.size.width, originalImage.size.height); 

    UIImage* editedImage = [info objectForKey:UIImagePickerControllerEditedImage]; 
    NSLog(@"Edited image width: %f and height: %f", editedImage.size.width, editedImage.size.height); 

    [self dismissModalViewControllerAnimated:YES]; 
} 
+0

我試圖與該鏈接,但我仍然得到尺寸640 * 480。我已經更新後與我的SRC代碼。 – 2010-10-21 09:27:15

+0

檢查我編輯的答案 – phi 2010-10-21 13:05:46

+0

我已經更新src代碼 - (void)imagePickerController :(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { \t // UIImage * image = nil; \t [[iImagePicker parentViewController] dismissModalViewControllerAnimated:YES]; \t iIsImageSaved = YES; \t iSavedImage = [info objectForKey:@「UIImagePickerControllerOriginalImage」]; \t int width,height; \t width = iSavedImage.size.width; \t height = iSavedImage.size.height; \t \t iApp-> ImagePicked(iSavedImage); } 但我仍然得到相同的結果。我正在用4.1操作系統在第4代iPod上檢查它。 – 2010-10-22 04:48:22

相關問題