ios - 如何将具有多个 segues 的 Storyboards 用于一个 View Controller ?

标签 ios objective-c storyboard segue

我的应用程序将使用一个简单的登录类型选择器 View Controller ,然后它将分支到不同的 View Controller ,即注册、登录和使用社交网络登录。现在我如何将所有这些的 segue 添加到一个单一的目标 View Controller 。如何添加这些多个 segues。

最佳答案

每个 ViewController 都应该有自己的序列。要创建,请按“Ctrl”并移动到您想要的 ViewController

enter image description here

并且每个 ViewController 都应该实现“prepareForSegue”

- (void)prepareForSegue:(UIStoryboardPopoverSegue *)segue sender:(id)sender {
    if ([segue.destinationViewController isKindOfClass:[MyDestinationVC class]]) {
        //do something
        //Example
        MyDestinationVC *screen = (MyDestinationVC *)segue.destinationViewController;
        screen.someValue = self.sendedValue;
    }
}

关于ios - 如何将具有多个 segues 的 Storyboards 用于一个 View Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23212066/

相关文章:

javascript - iOS 和 Android 中的任何浏览器是否允许在应用程序(浏览器)处于非 Activity 状态/后台时触发事件?

ios - 长按时 MKPointAnnotation 变为红色图钉

iphone - 如何在运行时将一行插入 iPhone 上的 UITableView?

objective-c - 通过segue传递数据

javascript - WKWebView 在后台不运行 JavaScript

iphone - 从 iOS 应用调用 Lua 脚本

objective-c - 打开我自己的 Mac 应用程序首选项

iphone - 在 Container view 中使用 UITableView for forms - 如何访问表单字段?

xcode - PerformSegueWithIdentifier 和prepareForSegue

ios - 在 Controller Swift 之间传递对象