开发者

UIImagePicker Shows blank when application in landscape

I am using navigation based application here when i call UIImagePicker then it show blank when the screen is in landscape but this shows correctly when the screen in portrait.

How can i change screen to portrait when its in landscape.

I using the code to call photo album is

UIImagePickerController *p开发者_开发百科icker = [[UIImagePickerController alloc] init];  
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;  
picker.delegate = self;  
[self presentModalViewController:picker animated:YES];
[picker release];

Edited:

Actually i am using TabBarController Which was pushed from another view using the concept of navigationController then when i tried to call UIImagePickerController when it is in landscape then shows blank. But without TabBarController UIImagePickerController works perfect(Automatically rotate to portrait)..

So how could i call UIImagePickerController when in landscape in TabBarController.

Thanks..


If this happens in a UIViewController then do the following so that the view is never rotated:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return NO;
}


if u want to forcefully rotate in portrait use

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{


 return (interfaceOrientation==UIInterfaceOrientationPortrait||UIInterfaceOrientationPortraitUpsideDown)


}


UIImagePickerController is portrait-only, see the documentation:

Important: The UIImagePickerController class supports portrait mode only. This class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified [...]

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜