doudou
doudou

Reputation: 91

How to change the modalPresentationStyle when the modal view controller is already shown?

I want to set my UIModalPresentationFormSheet style modal view to become UIModalPresentationFullScreen style sometime,but when it's already shown with UIModalPresentationFormSheet style,it can't goto fullscreen using code"[xx setModalPresentationStyle:UIModalPresentationFullScreen];"

Is there a way to change the present style after a modal view shown? My code like this:

UITableDownload* vc = [[UITableDownload alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
[nav setModalPresentationStyle:UIModalPresentationFormSheet];
[MainAppDelegate mainBrowserViewController] presentModalViewController:nav animated:YES];

...//after shown,sometime I implement following code:
[nav setModalPresentationStyle:UIModalPresentationFullScreen];//(The "nav" object is the same as above code)
//But the change style code takes no effect.

Upvotes: 9

Views: 3926

Answers (3)

Kyle Clegg
Kyle Clegg

Reputation: 39470

This is still a question for me in an iOS 7 app and at this point I'm left to conclude that changing the modalPresentationStyle after the transition has occurred just has no effect.

Upvotes: 1

nabiullinas
nabiullinas

Reputation: 1245

I think, you can try to change modalpresentationStyle as UIModalPresentationPageSheet

[nav setModalPresentationStyle:UIModalPresentationPageSheet];

This type should autorotate your modal view

Upvotes: 0

NWCoder
NWCoder

Reputation: 5266

Not sure if this is the answer or not, but have you tried accessing the controller via the modalViewController?

Something like:

[self.modalViewController setModalPresentationStyle:UIModalPresentationFullScreen];

rather than the:

[nav setModalPresentationStyle:UIModalPresentationFullScreen]; 

Upvotes: 0

Related Questions