Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 当显示操作表(AlertController)时,如何修复PopoverViewController的边界?_Ios_Objective C_Ios8_Uialertcontroller - Fatal编程技术网

Ios 当显示操作表(AlertController)时,如何修复PopoverViewController的边界?

Ios 当显示操作表(AlertController)时,如何修复PopoverViewController的边界?,ios,objective-c,ios8,uialertcontroller,Ios,Objective C,Ios8,Uialertcontroller,当ViewController通过UIPopoverPresentationController以iOS 8方式呈现动作表(AlertController)时,ViewController会将其边界缩小到动作表的大小 我想做的是在popover上显示一个动作表,但我用iOS 8的方式,我遇到了这种奇怪的情况 这就是我遇到这种情况的原因” 当按下按钮时,UIPopoverPresentationController会弹出ViewController(如图1所示) 按下ViewController上

当ViewController通过UIPopoverPresentationController以iOS 8方式呈现动作表(AlertController)时,ViewController会将其边界缩小到动作表的大小

我想做的是在popover上显示一个动作表,但我用iOS 8的方式,我遇到了这种奇怪的情况

这就是我遇到这种情况的原因”

  • 当按下按钮时,UIPopoverPresentationController会弹出ViewController(如图1所示)
  • 按下ViewController上的按钮时,将显示一个操作表
  • 然后ViewController将其大小缩小为actionSheet的大小。(如图2所示)
  • 这里是整个项目的参考。 它在“TryalertonPopoveronBarbuttoniMonipad”项目中


    只需在ViewController.m中为导航控制器使用
    preferredContentSize

    像这样:

    - (void)action:(id)sender
    {
        // ....
        UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:historyViewController];
        navigationController.modalPresentationStyle = UIModalPresentationPopover;
        navigationController.preferredContentSize =CGSizeMake(320, 480);
        // ...
    }
    
    布局子视图控制器的任何容器视图的首选内容大小


    参考资料:

    为什么iOS 8操作表是方形的。上面修复了popover的大小问题。但是在iOS 8操作表的popover中,其他按钮都是方形的。你可以在上面的屏幕截图中看到。这似乎只发生在popover中。