Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protocol SwitchKeyboardDelegate: class {
- func switchKeyboard()
- }
- class CustomAccessoryView: UIView {
- weak var delegate: SwitchKeyboardDelegate!
- required init?(coder aDecoder: NSCoder) {
- super.init(coder: aDecoder)
- initializeSubviews()
- }
- override init(frame: CGRect) {
- super.init(frame: frame)
- initializeSubviews()
- }
- func initializeSubviews() {
- // 不需包括xib檔名
- let xibFileName = "CustomAccessoryView"
- let view = Bundle.main.loadNibNamed(xibFileName, owner: self, options: nil)![0] as! UIView
- self.addSubview(view)
- view.frame = self.bounds
- }
- @IBAction func switchBtnTap(){
- self.delegate.switchKeyboard();
- }
- }
Add Comment
Please, Sign In to add comment