2014-03-27 43 views
-1

我可以拍照並在imageviewn中顯示,但只要我離開detailviewn並返回到detailviewn其消失。圖像應該如何保存?如何將所選圖像保存在UIImagePicker控制器中?

- (IBAction)takePhoto:(UIButton *)sender { 

UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 
picker.delegate = self; 
picker.allowsEditing = YES; 
picker.sourceType = UIImagePickerControllerSourceTypeCamera; 

[self presentViewController:picker animated:YES completion:NULL]; 

} 

- (IBAction)selectPhoto:(UIButton *)sender { 

UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 
picker.delegate = self; 
picker.allowsEditing = YES; 
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 

[self presentViewController:picker animated:YES completion:NULL]; 


} 



- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { 

UIImage *chosenImage = info[UIImagePickerControllerEditedImage]; 
self.imageView.image = chosenImage; 

[picker dismissViewControllerAnimated:YES completion:NULL]; 

} 

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { 

[picker dismissViewControllerAnimated:YES completion:NULL]; 

} 
+0

保存圖像的文檔目錄,並在重新裝入你回到視圖...? – CW0007007

+0

你寫過圖片視圖代碼在視圖中會出現方法嗎? –

回答

0

檢查廈門國際銀行文件的IBOutlet中的連接,你必須保存在應用程序的文件目錄下拍攝時,圖像除非你無法查看所選圖像

相關問題