首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >iOS8变更UIPopoverPresentationController特性集合

iOS8变更UIPopoverPresentationController特性集合
EN

Stack Overflow用户
提问于 2015-08-05 10:00:00
回答 1查看 700关注 0票数 1

我正在iphone和ipad上部署一个应用程序(iOS7和iOS8)。

我使用的故事板与大小类,基本上我有一个基本的大小类-任何适合iPad布局和紧凑-规则适合所有的iphone型号。

iPad版本中的一些视图控制器提供了自定义的幻灯片,另一些则带有弹出式。

虽然它在iOS7 ipad上运行得很好(因为xcode在iOS8上构建了不同的故事板),但我遇到的问题是,在iOS8上显示的内容选择了iphone界面。

我以通常的方式呈现出来:

代码语言:javascript
运行
复制
if (UIPopoverPresentationController.self) {
                    commentVC.modalPresentationStyle = UIModalPresentationPopover;
                    UIPopoverPresentationController * presentationController = commentVC.popoverPresentationController;
                    presentationController.sourceRect = [[(AFPostTimelineTableViewCell*)cell commentButton] frame];
                    presentationController.sourceView = cell;
                    presentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;
                    presentationController.delegate = weakSelf;
                    weakSelf.myPop = presentationController;
                    [weakSelf presentViewController:commentVC animated:YES completion:NULL];
                }

检查我看到的代码,显示视图控制器的UITraitCollection为C。

有没有办法让它选择R-R?

这里还有一个小示例

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-08-05 18:12:29

找到了解决方案,UIPresentationController中有属性可以设置在呈现的-overrideTraitCollection上使用的UITraitCollection

代码语言:javascript
运行
复制
presentationController.overrideTraitCollection= combinedTraits.copy;
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31829232

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档