We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
swift
{targetName}-Bridging-Header.h
public
@objc
import UIKit public class KKLabel: UIView { @objc public lazy var lab = UILabel() @objc public lazy var bt = UIButton() @objc public func initText(withFrame: CGRect, text: String) { lab = UILabel.init(frame: CGRect.init(x: 15, y: UIApplication.shared.statusBarFrame.size.height + 60, width: UIScreen.main.bounds.size.width - 30, height: 60)); lab.text = text lab.font = .systemFont(ofSize: 12) lab.textColor = .black lab.numberOfLines = 0 self.addSubview(lab) bt = UIButton.init(type: .custom) bt.setTitle("woshiBT", for: .normal) bt.setTitleColor(.blue, for: .normal) bt.addTarget(self, action: #selector(buuton), for: .touchUpInside) bt.titleLabel?.font = .systemFont(ofSize: 16) bt.backgroundColor = .gray bt.frame = CGRect.init(x: 60, y: lab.frame.origin.y + 120, width: UIScreen.main.bounds.size.width-120, height: 50) self.addSubview(bt) } @objc func buuton(){ print("=========") } /* // Only override draw() if you perform custom drawing. // An empty implementation adversely affects performance during animation. override func draw(_ rect: CGRect) { // Drawing code } */ }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
1.
swift
项目调用OC代码{targetName}-Bridging-Header.h
文件 ,把oc的头文件导进这个文件中2. oc项目调用
swift
代码swift
代码中要把类名加public
@objc
public
The text was updated successfully, but these errors were encountered: