首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UIStoryboardSegue子类标识类型

UIStoryboardSegue子类标识类型
EN

Stack Overflow用户
提问于 2016-12-31 18:52:53
回答 1查看 454关注 0票数 0
代码语言:javascript
复制
class CustomSegue: UIStoryboardSegue {

    override init(identifier: String?, source: UIViewController, destination: UIViewController) {
        super.init(identifier: identifier, source: source, destination: destination)
    }

    override func perform() {

        self.source.navigationController?.pushViewController(self.destination, animated: true)

    }

}

在上面的代码中,我将重写segue的行为。只有在其他类型为pushViewController显示(例如: Push)的情况下,它才应该使用,它应该执行它能够执行的默认行为。

如何在子类Kind方法中找到segue的Kind

i.e

代码语言:javascript
复制
       override func perform() {

            if kind==Push { 
              self.source.navigationController?.pushViewController(self.destination, animated: true)
            } else {
              super.perform()
            }

        }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-01-01 08:40:04

在故事板中,选择segue作为自定义segue,选择select作为自定义segue,对于默认行为,只需选择show segue (例如push)。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41410957

复制
相关文章

相似问题

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