在我的iPad應用程序中,我正在打開Popover控制器中的Photo Library。這是工作的罰款中的iOS 4,但 我用下面的代碼打開圖片庫,現在它不是在IOS 5對外開放,UIPopOverController中的UIImagePickerController未在iOS 5中打開
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
picker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
popOver = [[UIPopoverController alloc] initWithContentViewController:picker];
popOver.delegate = self;
int w = 320;
CGRect pickerFrame = CGRectMake(0, 0, w, bImportPicker.frame.origin.y);
[popOver setPopoverContentSize:pickerFrame.size animated:NO];
[popOver presentPopoverFromRect:pickerFrame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
[picker release];
注意:如果你正在模擬器上測試,模擬器庫上應該有圖像。 –