【问题标题】:How navigate from viewcontroller.swift file to corresponding scene in *.storyboard file?如何从 viewcontroller.swift 文件导航到 *.storyboard 文件中的相应场景?
【发布时间】:2020-12-23 23:08:07
【问题描述】:

Xcode 中是否有一种方法(组合键、上下文菜单)可以从自定义 UIViewController(例如AViewController.swift)文件快速导航到情节提要中的屏幕,其中 AViewController.swift 在身份检查器选项卡?

【问题讨论】:

    标签: ios swift xcode


    【解决方案1】:

    您需要在情节提要的身份检查器中设置情节提要 ID。然后推送:

    let vc = storyBoard.instantiateViewController(withIdentifier: identifier)
    vc.modalPresentationStyle = .fullScreen
    self.navigationController?.pushViewController(vc, animated: true)
    

    标识符是故事板ID

    或者你可以用:

    let vc = storyBoard.instantiateViewController(withIdentifier: identifier)
    vc.modalPresentationStyle = .fullScreen
    self.present(vc, animated: true)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-11-19
      • 1970-01-01
      • 2014-12-06
      • 1970-01-01
      • 1970-01-01
      • 2017-01-05
      • 1970-01-01
      相关资源
      最近更新 更多