views:

79

answers:

2

Hi,

I am presenting MFMailComposeViewController(mailController) using presentModalViewController on my UIViewController, In mailController(subclass of MFMailComposeViewController) class i have overhide shouldAutorotateToInterfaceOrientation as

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

But in my UIViewController class i have overhide shouldAutorotateToInterfaceOrientation as(this is my project need)

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

After presenting my mailcontroller, if i rotate the device it works perfectly as expected( supporting landscapeleft/right orientation) in iPhone... But the same code is not working in iPad. Am i doing any mistake here? is it is Apple bug?

I am presenting using this api [myViewController presentModalViewController:mailController animated:YES];

and i am getting this warning on both iPhone and iPad The view controller <UINavigationController: 0x7720920> returned NO from -shouldAutorotateToInterfaceOrientation: for all interface orientations. It should support at least one orientation.

Thanks,

A: 

What you're actually saying is "I don't support ANY orientation", which is of course... not true.

You should return true for at least one orientation. For example:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
   return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
Philippe Leybaert
Once the mailcontroller is presented and if i rotate the device the mailcontroller is not rotating in iPad. but i have used the same code for iPhone it is working correctly in iPhone. I think it is apple bug.
Chandan Shetty SP
If it's a bug, it's on the iPhone, not the iPad. In any case, this method should not return FALSE for every orientation.
Philippe Leybaert
A: 

This Method will allow both landscape orientation's:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
Luke Mcneice