简体   繁体   中英

Xcode segues for different devices

I make an application for iPhone and iPad. I want that different segues for different devices. An example for iPhone segue is "Show" and iPad is "Show Detail". I tried it in the Storyboard but it doesn't helped me. How can I do it?

Just create the segues with some identifier and based on the device perform some segue. I think there is no built in way to do it from storyboard.

While there is no built in way to do this, there are some creative workarounds. The answer I'm giving you will work, but it is primitive. You are correct that you cannot create two segues from the same table view cell, so you need to make two table view cell files, with the one inheriting from the other. Each file can contain a separate segue, and you can call that segue depending on which device is running at that time. You can check to see which device is running in AppDelegate.

Pseudo code would look something like this:

if device is iphone {

use this segue

} else if device is ipad {

use this other segue

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM