小编Kur*_*son的帖子

为什么iPhone 6 Plus Landscape不使用preferredContentSize?

在我的iOS 8应用程序中,除了iPhone 6 Plus横向外,所有方向的所有设备上都能正确显示此popover segue:

好的popover

这就是它在iPhone 6 Plus环境中的外观(它几乎从上到下延伸): 糟糕的popover

当它显示如下时,单击视图外部并不会忽略它(虽然取消确实有效).旋转回肖像使其恢复正常.

其中的所有约束UIViewController都安装在所有大小的类上.

在调试值时,viewDidAppear:我看到以下内容:

  • po self.view:frame =(0 0; 250 394)
  • po self.preferredContentSize(width = 250,height = 160)

是什么导致视图的高度跳到394?

我实际上也遇到了与iPhone 6 Plus环境中另一个popover segue相同的问题.(如果有好奇心,我在这里使用的是VC而不是'UIAlertController',因为UITextField显示的验证要求不能正常使用UIAlertController.)

编辑以包含我的弹出代码:

此代码可在以下位置找到 prepareForSegue:

    FavoriteNameViewController *nameVC = segue.destinationViewController;
    UIPopoverPresentationController *popPC = nameVC.popoverPresentationController;
    popPC.delegate = self;
    nameVC.delegate = self;
    nameVC.view.center = self.originalContentView.center;
Run Code Online (Sandbox Code Playgroud)

然后是委托方法:

- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller {
    return UIModalPresentationNone;
}
Run Code Online (Sandbox Code Playgroud)

这是Xcode中的segue定义: 在此输入图像描述

uiviewcontroller ios iphone-6-plus

11
推荐指数
1
解决办法
3053
查看次数

如何在Xcode 6中删除特定的大小类预览?

在Xcode 6中,我打开了预览版,这样我就可以看到我的故事板在不同设备上的外观.我可以在预览中添加设备.事实上,我可以一遍又一遍地将相同的设备添加到预览中.但是如何从预览中删除设备?我尝试关闭Xcode并重新打开它,但它们仍在那里.

xcode6

8
推荐指数
1
解决办法
2182
查看次数

iOS 7中的大小类

我使用Size Classes在Xcode 6中创建了一个新的应用程序.在使用iOS 7进行测试后,我无法弄清楚如何在横向模式下让iPhone显示特定大小的类.

我首先使用iPhone版本开发了UI作为wAny hCompact,但iOS 7无法识别.我在wAny hAny中有iPhone肖像.

然后我改变它,所以现在我正在使用wCompact hRegular for iPhone portrait.然后我修改了wAny hAny作为横向布局.但是当iOS 7设备处于横向状态时,它不会使用该布局.

iOS 7是否能够根据设备的纵向或横向使用不同的大小类?如果是这样,我应该使用哪个尺寸类?

参考: 有关向后兼容大小类的实用信息.

PS.我并不关心iPad,因为根据iOS 8中的设备旋转,设备不会显示不同的大小类.

iphone xcode size-classes

7
推荐指数
1
解决办法
7558
查看次数

单击外部弹出窗口时如何防止UIPopoverPresentationController被解雇?

在我的通用iOS 8应用程序中,我使用UIPopoverPresentationController如下所示的使用使用弹出窗口prepareForSegue:

FavoriteNameViewController *nameVC = segue.destinationViewController;
UIPopoverPresentationController *popPC = nameVC.popoverPresentationController;
popPC.delegate = self;
Run Code Online (Sandbox Code Playgroud)

并使用此委托方法.

- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller {
return UIModalPresentationNone;
}
Run Code Online (Sandbox Code Playgroud)

在这种特殊情况下,我提出的视图控制器看起来像一个警报,但事实并非如此.

在此输入图像描述

现在我的问题是用户可以点击此弹出窗口之外的内容而被解雇.这没有真正的问题,除了警报不是如何工作,我希望这可以模拟警报.

我看到UIPopoverControllerDelegate有一个方法叫popoverControllerShouldDismissPopover:,但UIPopoverPresentationControllerDelegate没有那个方法,我相信我需要使用后者.

objective-c uipopovercontroller ios

6
推荐指数
1
解决办法
3074
查看次数