2012-02-29 24 views

回答

7

看到這個answer by Jane Sales

從答案這個問題Set dimensions for UIImagePickerController 「move and scale」 cropbox

我推薦的解決方案是爲圖像拾取 禁用編輯和自己處理。例如,我將圖像放在一個可滾動的圖像視圖中。在圖像視圖頂部是固定位置 「作物指南視圖」,繪製用戶看到的作物指示圖。 假設指南視圖具有可見矩形的屬性(要保留的部分 )和邊緣寬度(要放棄的部分),您可以像這樣獲取修剪矩形。

這裏是鏈接Re-sizing + UIImage

1)Link for Cropping a UIImage

2)Another link

3)More things to do with UIImage

+0

您提供「簡銷售的答案」用的UIImage的委託方法,但我想這種類型的鏈接來自照片庫的圖像。那我該怎麼做呢? – Rohan 2012-03-01 13:19:31

0

請通過而另一些人不工作這個答案... 。:)

In ZBar project有一些示例應用程序,它採用條形碼的圖片。它允許移動和縮放圖像。我havnt看了看代碼。但是你可以嘗試作爲最後的選擇。

3

這是非常晚,但希望它會有所幫助。

在的UIImagePickerController委託方法imagePickerController:didFinishPickingMediaWithInfo:的「移動」和「縮放」圖像通過UIImagePickerControllerEditedImage鍵訪問這樣

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
{ 
    UIImage *img = (UIImage *)[info objectForKey: UIImagePickerControllerEditedImage]; 

// Do what you need to with that image 

} 

希望它可以幫助別人!

2

也許你正在尋找:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; 
[imagePicker setAllowsEditing:YES]; 

然後在委託方法:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
{ 
    UIImage *chosenImage = [info objectForKey:UIImagePickerControllerEditedImage]; 
    if(!chosenImage) { 
     chosenImage = [info objectForKey:UIImagePickerControllerOriginalImage]; 
    } 
    [self dismissViewControllerAnimated:YES completion:nil]; 
} 
相關問題