从MasterViewController呈现的ModalView在iOS 5.1中不再是全屏

时间:2012-04-12 04:25:28

标签: objective-c ios ipad uiviewcontroller uisplitviewcontroller

我有一个Master / Detail应用程序,并且在拆分视图中的MasterViewController右上角有一个按钮,它使用模态视图加载“Info”视图控制器:

popover in iOS 5.0

单击该按钮时,将加载视图,并在iOS 5.0及更低版本中填充整个屏幕(这是我想要的行为):

- (IBAction)showAppInfo:(id)sender 
{
    InfoViewController *infoViewController = [[InfoViewController alloc] 
        initWithNibName:@"InfoViewController" bundle:nil];
    infoViewController.delegate = self;
    [self presentModalViewController: infoViewController animated: YES];
}

modalView in iOS 5.0

然而,当我在iOS 5.1模拟器中运行它时,它不再填充整个iPad屏幕,只填充主视图中的内容:

modal view in iOS 5.1

如何让这个InfoViewController像以前一样在iOS 5.1中填充整个屏幕?

1 个答案:

答案 0 :(得分:0)

我假设你正在使用UIPopoverController,试试这个

InfoViewController *infoViewController = [[InfoViewController alloc] 
    initWithNibName:@"InfoViewController" bundle:nil];
UIPopoverController *popoverController      =   [[UIPopoverController alloc] initWithContentViewController:infoViewController];
    popoverController.popoverContentSize        =   CGSizeMake(500.0, 583.0);
    popoverController.delegate                  =   self;
    [popoverController presentPopoverFromRect:sender.bounds inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];