user403015
user403015

Reputation: 7227

modalPresentationStyle not working in modal view in iOS5

I want to display a popup window in iPad using the UIView's presentModalViewController method in iOS5.

Even though I set the modalPresentationStyle to UIModalPresentationFormSheet, it only displays as full frame size.

I used the same code in iOS4 before, and it can display as a popup window. How to fix it in iOS5?


DetailViewController *d = [[DetailViewController alloc] initWithNibName:nil bundle:nil];
self.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:d animated:YES];

Thanks.

Upvotes: 2

Views: 3015

Answers (2)

user403015
user403015

Reputation: 7227

In iOS5, the modal view should be used as below.


DetailViewController *d = [[DetailViewController alloc] initWithNibName:nil bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:d];
navigationController.modalPresentationStyle = UIModalPresentationFormSheet; [self presentModalViewController:navigationController animated:YES];

Upvotes: 3

KIDdAe
KIDdAe

Reputation: 2722

Have you try

d.modalPresentationStyle = UIModalPresentationFormSheet;

instead of

self.modalPresentationStyle = UIModalPresentationFormSheet;

Upvotes: 3

Related Questions