以横向模式打开UIImagePickerController

问题描述:

我想在我的应用程序中打开iphone保存的图像。我的应用程序在横向模式下工作当我尝试使用presentModalViewController方法从iphone库加载所有保存的照片时,它将以纵向模式打开。我希望在横向模式下。这是代码:

I want to open iphone saved images in my application. my application working in landscape mode. when I trying to load all saved photo from iphone library using presentModalViewController method, it will open in portrait mode. I want that in landscape mode. here is the code:

picker = [[UIImagePickerController alloc] init];
picker.delegate = self;

picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
picker.allowsEditing = NO;
picker.navigationBarHidden = YES;
picker.wantsFullScreenLayout = YES;
[picker setNavigationBarHidden:TRUE];

[self presentModalViewController:picker animated:NO];
NSLog(@"%@", self.view.subviews);
[picker release];  

任何人都可以帮助我..
提前致谢。

can any one help me.. Thanks in advance.

你做不到。 Quoth 文档

You can't. Quoth the documentation:


UIImagePickerController 类仅支持纵向模式。这个类打算按原样使用,不支持子类化。

The UIImagePickerController class supports portrait mode only. This class is intended to be used as-is and does not support subclassing.

这是一个更多的工作,但你可以使用 AssetsLibrary framework 以访问图片列表并创建自己的图像选择器。

It's a bit more work, but you can use the AssetsLibrary framework to access the list of images and create your own image picker.