因此,在我的 iPhone 4 设备中,我选择了一张图片后,我希望图片选择器弹出框消失。以下代码适用于 iOS 5 上的 iPad 3、iOS 6 上的 iPad 4、iOS 5 上的 iPhone 4 但以下代码不适用于 iOS 6 上的 iPhone 5。这是为什么?
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self loadImage:[info objectForKey:UIImagePickerControllerOriginalImage]];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ) {
if ([popoverController isPopoverVisible]) {
// called for iPad
[popoverController dismissPopoverAnimated:YES];
}
}
else {
// called for iPhone
[self dismissModalViewControllerAnimated:YES]; <== NOT WORKING
[self dismissViewControllerAnimated:YES completion:nil]; <== ALSO NOT WORKING
}