在通用故事板中使用礼物作为弹出框 [英] Use present as popover in a universal storyboard

查看:18
本文介绍了在通用故事板中使用礼物作为弹出框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apple 建议通过大小类为通用应用程序使用单个故事板.现在我正在尝试根据设备调整 UI,到目前为止,该设备运行良好.我面临的唯一问题是如何分配特定的转场.例如,我的应用程序中仅包含两个 tableview 单元格的设置应该通过 iPad 上的呈现为弹出框"和 iPhone 上的常规显示(例如推送)"segue 显示.

Apple recommends to use a single storyboard for universal apps through size classes. Now I am trying to adapt the UI depending on the device, which has worked quiet well so far. The only problem I'm facing is how to assign the specific segues. For instance the settings, which in my App consist of only two tableview cells, should be made visible via a "present as a popover" on the iPad and a regular "show (e.g. Push)" segue on the iPhone.

有没有办法像使用故事板那样定义它,或者我需要编写支持代码?

Is there any way to define it just like that using storyboards or do I need to write supporting code?

尼克

推荐答案

在 WWDC 会议中,Apple 工程师使用了Present as popover"segue.这一个在 iPhone 上以模态方式显示视图,在 iPad 上显示弹出窗口.不过,您必须编写一些代码才能在 iPhone 上显示后退按钮.

In WWDC session Apple engineer used "Present as popover" segue. This one shows view modally on iPhone and popover on iPad. Though, you'll have to write some code to show Back button on iPhone.

如果你需要popover和push segues,我会在代码中这样做:

If you need to have popover and push segues, I'd do that in code this way:

  1. 制作 2 个 segues 'Present as popover' 和 'Show'
  2. 设置转场标识符
  3. 在代码中确定应用是在 iPhone 还是 iPad 上运行
  4. 启动正确的转场

这篇关于在通用故事板中使用礼物作为弹出框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆