需要帮助将这段代码从 Swift 转换为 Objective-C

匿名

我有一个 Objective-C 应用程序,我需要从代码中加载另一个 VC 类。我已经在另一个 Swift 应用程序中成功实现了这一点。

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];

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章