<small id='qlEO7'></small><noframes id='qlEO7'>

<legend id='qlEO7'><style id='qlEO7'><dir id='qlEO7'><q id='qlEO7'></q></dir></style></legend>

  1. <i id='qlEO7'><tr id='qlEO7'><dt id='qlEO7'><q id='qlEO7'><span id='qlEO7'><b id='qlEO7'><form id='qlEO7'><ins id='qlEO7'></ins><ul id='qlEO7'></ul><sub id='qlEO7'></sub></form><legend id='qlEO7'></legend><bdo id='qlEO7'><pre id='qlEO7'><center id='qlEO7'></center></pre></bdo></b><th id='qlEO7'></th></span></q></dt></tr></i><div id='qlEO7'><tfoot id='qlEO7'></tfoot><dl id='qlEO7'><fieldset id='qlEO7'></fieldset></dl></div>

      • <bdo id='qlEO7'></bdo><ul id='qlEO7'></ul>

    1. <tfoot id='qlEO7'></tfoot>
    2. 如何使用 Swift 从一个视图控制器导航到另一个视图控制器

      How to Navigate from one View Controller to another using Swift(如何使用 Swift 从一个视图控制器导航到另一个视图控制器)

          <tbody id='oU1Za'></tbody>
          <legend id='oU1Za'><style id='oU1Za'><dir id='oU1Za'><q id='oU1Za'></q></dir></style></legend>
            <bdo id='oU1Za'></bdo><ul id='oU1Za'></ul>

            <small id='oU1Za'></small><noframes id='oU1Za'>

            <i id='oU1Za'><tr id='oU1Za'><dt id='oU1Za'><q id='oU1Za'><span id='oU1Za'><b id='oU1Za'><form id='oU1Za'><ins id='oU1Za'></ins><ul id='oU1Za'></ul><sub id='oU1Za'></sub></form><legend id='oU1Za'></legend><bdo id='oU1Za'><pre id='oU1Za'><center id='oU1Za'></center></pre></bdo></b><th id='oU1Za'></th></span></q></dt></tr></i><div id='oU1Za'><tfoot id='oU1Za'></tfoot><dl id='oU1Za'><fieldset id='oU1Za'></fieldset></dl></div>
            <tfoot id='oU1Za'></tfoot>

                本文介绍了如何使用 Swift 从一个视图控制器导航到另一个视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我想从一个视图控制器导航到另一个.如何将以下 Objective-C 代码转换为 Swift?

                I'd like to navigate from one view controller to another. How can I convert the following Objective-C code into Swift?

                UIViewController *viewController = [[self storyboard] instantiateViewControllerWithIdentifier:@"Identifier"];
                UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:viewController];
                [self.navigationController pushViewController:navi animated:YES];
                

                推荐答案

                为第二个视图控制器创建一个swift文件(SecondViewController.swift)并在适当的函数中输入:

                Create a swift file (SecondViewController.swift) for the second view controller and in the appropriate function type this:

                let secondViewController = self.storyboard.instantiateViewControllerWithIdentifier("SecondViewController") as SecondViewController
                self.navigationController.pushViewController(secondViewController, animated: true)
                

                <小时>

                斯威夫特 2+

                let mapViewControllerObj = self.storyboard?.instantiateViewControllerWithIdentifier("MapViewControllerIdentifier") as? MapViewController
                self.navigationController?.pushViewController(mapViewControllerObj!, animated: true)
                

                <小时>

                斯威夫特 4

                let vc = UIStoryboard.init(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "IKDetailVC") as? IKDetailVC
                self.navigationController?.pushViewController(vc!, animated: true)
                

                这篇关于如何使用 Swift 从一个视图控制器导航到另一个视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                iOS 6 rotations: supportedInterfaceOrientations doesn#180;t work?(iOS 6 旋转:supportedInterfaceOrientations 不起作用?)
                CABasicAnimation rotate returns to original position(CABasicAnimation 旋转返回原始位置)
                UITabBarController Rotation Issues in ios 6(ios 6 中的 UITabBarController 旋转问题)
                iOS: How to run a function after Device has Rotated (Swift)(iOS:设备旋转后如何运行函数(Swift))
                How to rotate an image 90 degrees on iOS?(如何在 iOS 上将图像旋转 90 度?)
                iOS 8 Rotation Methods Deprecation - Backwards Compatibility(iOS 8 旋转方法弃用 - 向后兼容性)
                • <i id='jGnN2'><tr id='jGnN2'><dt id='jGnN2'><q id='jGnN2'><span id='jGnN2'><b id='jGnN2'><form id='jGnN2'><ins id='jGnN2'></ins><ul id='jGnN2'></ul><sub id='jGnN2'></sub></form><legend id='jGnN2'></legend><bdo id='jGnN2'><pre id='jGnN2'><center id='jGnN2'></center></pre></bdo></b><th id='jGnN2'></th></span></q></dt></tr></i><div id='jGnN2'><tfoot id='jGnN2'></tfoot><dl id='jGnN2'><fieldset id='jGnN2'></fieldset></dl></div>
                    <tfoot id='jGnN2'></tfoot>

                      <bdo id='jGnN2'></bdo><ul id='jGnN2'></ul>
                        <tbody id='jGnN2'></tbody>

                      <small id='jGnN2'></small><noframes id='jGnN2'>

                      1. <legend id='jGnN2'><style id='jGnN2'><dir id='jGnN2'><q id='jGnN2'></q></dir></style></legend>