【发布时间】:2017-11-08 12:25:28
【问题描述】:
我正在尝试将数据从 Objective-C ViewController 传递到 Swift ViewController,但在我的 Objective-C 控制器中出现此错误:
在“UIViewController”类型的对象上找不到属性“类型”
我的 Objective-C 代码:
UIViewController *mainController = [self.storyboard instantiateViewControllerWithIdentifier:@"IdentitySelfieViewController"];
mainController.type = "passport";
[self.navigationController pushViewController:mainController animated:YES];
导入到 Bridging-header 文件中:
#import "PassportViewController.h"
并在我的 Swift 视图控制器中创建了相应的字符串
let type = ""
感谢您的帮助
【问题讨论】:
-
你需要从Objective-C导入的类中创建一个对象。
-
哦...请问您是否有任何示例可以与我分享?谢谢
-
我已经有一年没做过了,但我觉得有点像下面这样。让 passportInstance: PassportViewController = PassportViewController()
-
我会调查这个,谢谢:)
-
创建 Swift 类的对象。例如
IdentitySelfieViewController * mainController.
标签: ios swift objective-c xcode uiviewcontroller