UIImagePickerDelegate - 官方文檔說明

 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info   // 當用戶選中了一個靜態圖片或者視頻時,會自動發送給委託對象。ide

  info的鍵值選項以下:函數

1 NSString *const UIImagePickerControllerMediaType;
2 NSString *const UIImagePickerControllerOriginalImage;
3 NSString *const UIImagePickerControllerEditedImage;
4 NSString *const UIImagePickerControllerCropRect;
5 NSString *const UIImagePickerControllerMediaURL;
6 NSString *const UIImagePickerControllerReferenceURL;
7 NSString *const UIImagePickerControllerMediaMetadata;

  你的委託對象在該方法的實現中,傳遞給須要特定media的對象,而後委託對象應該調用dismissModalViewControllerAnimated:completion:方法來返回原視圖。spa

  若是要保存靜態圖片到用戶的相片集中,在該方法體內調用UIImageWriteToSavedPhotosAlbum函數。若是要保存視頻,則須要調用UISaveVideoAtPathToSavedPhotosAlbum函數。code

 

 - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker   // 當用戶取消圖片選擇時,調用。該方法的實現是可選的,若是實現的話,委託對象應該調用dismissModalViewControllerAnimated:completion:方法來返回原視圖。視頻

相關文章
相關標籤/搜索