我想在iOS5中使用UIView的presentModalViewController方法在iPad中显示一个弹出窗口。
即使我将modalPresentationStyle设置为UIModalPresentationFormSheet,它也只显示为全帧大小。
之前我在iOS4中使用了相同的代码,它可以显示为弹出窗口。如何在iOS5中修复它?
DetailViewController *d = [[DetailViewController alloc] initWithNibName:nil bundle:nil];
self.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:d animated:YES];
感谢。
答案 0 :(得分:3)
你试试吗
d.modalPresentationStyle = UIModalPresentationFormSheet;
而不是
self.modalPresentationStyle = UIModalPresentationFormSheet;
答案 1 :(得分:3)
在iOS5中,模态视图应如下所示。
DetailViewController *d = [[DetailViewController alloc] initWithNibName:nil bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:d];
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:navigationController animated:YES];