2012-07-23 79 views

回答

0

docs

myImagePickerController.mediaTypes = 
    [[NSArray alloc] initWithObjects: (NSString *) kUTTypeImage, nil]; 
1

使用下面的代码来显示MediaLibrary。

imgPicker = [[UIImagePickerController alloc] init]; 
imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
imgPicker.delegate = self; 
imgPicker.allowsEditing = YES; 
[self presentModalViewController:imgPicker animated:YES]; 

它只显示媒体库的图像。

+0

如果使用设备相机捕捉视频,则它们将被添加到PhotoLibrary中。您提供的代码将打开包含视频的PhotoLibrary。 – viral 2012-09-07 06:30:59

+2

然后将源类型更改为:UIImagePickerControllerSourceTypeSavedPhotosAlbum它会工作.... – Hemang 2012-09-07 07:01:01

+0

从链接:http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html - “'UIImagePickerControllerSourceTypeSavedPhotosAlbum' 指定设备的相机胶卷相册作为图像选取器控制器的来源。如果设备没有相机,请将”已保存的相片“相册指定为来源。 – viral 2012-09-07 07:04:31