需要帮助将这段代码从Swift转换为Objective-C吗
我有一个Objective-C应用程序,我需要从代码中加载另一个VC类。我已经设法在另一个Swift应用程序中实现了这一点需要帮助将这段代码从Swift转换为Objective-C吗,objective-c,swift,Objective C,Swift,我有一个Objective-C应用程序,我需要从代码中加载另一个VC类。我已经设法在另一个Swift应用程序中实现了这一点 let storyboard = UIStoryboard(name: "Main", bundle: nil) let controller = storyboard.instantiateViewController(withIdentifier: "OverrideClass") self.present(controller, animated: true, com
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let controller = storyboard.instantiateViewController(withIdentifier: "OverrideClass")
self.present(controller, animated: true, completion: nil)
我需要帮助为ObjC创建一个相同的函数。它基本上是用代码中提到的脚本标识符加载VC类。代码非常相似,只是语法不同
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:NULL];
UIViewController *controller = [storyboard instantiateViewControllerWithIdentifier:@"OverrideClass"];
[self presentViewController:controller animated:YES completion:NULL];
以下是您提供的代码,它们是用Objective-C重新编写的:
UIStoryboard * storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:NULL];
UIViewController * controller = [storyboard instantiateViewControllerWithIdentifier:@"OverrideClass"];
[self presentViewController:controller animated:YES completion:NULL];
任何Objective-C教程都将向您展示其语法是如何工作的。代码基本相同,只是语法不同。下面的链接可能对您有用