, for: .normal)
pushButton?.setTitle("push", for: .normal)
pushButton?.frame = CGRect.init(x: 50, y: 250, width: 200, height: 50)
pushButton?.layer.borderColor = UIColor.black.cgColor
pushButton?.layer.borderWidth = 1.0
pushButton?.addTarget(self, action: #selector(pushAction), for: .touchUpInside)
self.view.addSubview(pushButton!)
}
func popAction() -> Void {
if editorDelegate != nil {
editorDelegate?.editTextField((textField?.text)!)
}
if ((self.myEidtorBlock) != nil){
self.myEidtorBlock!((textField?.text!)!)
}
self.navigationController?.popViewController(animated: true)
}
func pushAction() -> Void {
let three = ThreeViewController.init()
self.navigationController?.pushViewController(three, animated: true)
}
2.2.3 在oc类中viewcontroller.m 文件中实现SecondviewController.swift的相关代理与闭包(block). 代码如下:
- #import "ViewController.h"
- #import "OcOrSwiftTwo-swift.h"
-
- @interface ViewController ()<EditTextFieldDelegate>
- @property (nonatomic, strong) UITextField *showTextField;
- @propert
|