[英]how can I access my swift project files from pod file which is in objective c?
[英]having a button in an objective c file (from a pod) and subclassing it from swift
因此,我目前正在使用包含XIB文件的SDK,并且已将按钮连接到其视图控制器,如下面的代码所示。 我已经在pod库本身中完成了此操作
- (IBAction)testButton:(UIButton *)sender {
NSLog(@"test");
}
然后,我将将这种方法放置在swift文件中的类作为子类。 但是,我无法从swift文件本身访问此按钮。 如何从swift文件本身覆盖此按钮的功能?
class MyLoginViewController: BLoginViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
//I am unable to override the button in this view controller
在您的BLoginViewController.h中添加此行
- (IBAction)testButton:(UIButton *)sender;
现在您可以像这样在MyLoginViewController中覆盖此方法
override func test(_ sender: UIButton!) {
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.