Use present as popover in a universal storyboard

2019-05-25 05:44发布

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?

Nick

1条回答
小情绪 Triste *
2楼-- · 2019-05-25 06:21

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.

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

  1. Make 2 segues 'Present as popover' and 'Show'
  2. Set up segue identifiers
  3. In code identify whether app running on iPhone or iPad
  4. Launch correct segue
查看更多
登录 后发表回答