brush51
brush51

Reputation: 5771

how to set orientation to correct device orientation after dismissModalViewController?

i have a detailview where content is displayed. with a button i am presenting another view modally:

[self.viewController presentModalViewController:helpViewController animated:NO];  

So, when i dismiss this helpViewController, the detailview is always in portraitMode.
Cant get it to the correct device orientation.

I have tried it with this to rotate it to device orientation:

if ([UIViewController respondsToSelector:@selector(  
    attemptRotationToDeviceOrientation)]) {

    [UIViewController attemptRotationToDeviceOrientation];
}  

It seems that after dismissing the helpViewController viewDidAppear is not called in detailView.
So how can i get that to work?

Upvotes: 2

Views: 543

Answers (1)

lu yuan
lu yuan

Reputation: 7227

Plz try to set the detailview.m as

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
{
// Return YES for supported orientations
return YES;
//    return (interfaceOrientation == UIInterfaceOrientationPortrait);

}

Upvotes: 1

Related Questions