Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
viewDidAppear self <SwiftPHFComposeBarTest.ViewController: 0x7fe088619d90>
composeBar.delegate Optional(<SwiftPHFComposeBarTest.ViewController: 0x7fe088619d90>)
composeBar.textView.delegate Optional(<PHFDelegateChain: 0x7fe088654850>)
composeBar.canBecomeFirstResponder() true
composeBar.textView.canBecomeFirstResponder() true
composeBar.becomeFirstResponder() false
composeBar.isFirstResponder() false
composeBar.textView.isFirstResponder() false
// ViewController.swift
// SwiftPHFComposeBarTest
import UIKit
import PHFComposeBarView
class ViewController: UIViewController, PHFComposeBarViewDelegate {
var composeBar: PHFComposeBarView {
let viewBounds = self.view.bounds
let frame = CGRectMake(0.0, viewBounds.size.height - PHFComposeBarViewInitialHeight, viewBounds.size.width, PHFComposeBarViewInitialHeight)
let composeBarView = PHFComposeBarView(frame: frame)
composeBarView.delegate = self
return composeBarView
}
override var inputAccessoryView: UIView {
return self.composeBar
}
override func canBecomeFirstResponder() -> Bool {
return true
}
override func viewDidAppear(animated: Bool) {
print("viewDidAppear self \(self)")
print("composeBar.delegate \(self.composeBar.delegate)")
print("composeBar.textView.delegate \(self.composeBar.textView.delegate)")
print("composeBar.canBecomeFirstResponder() \(self.composeBar.canBecomeFirstResponder())")
print("composeBar.textView.canBecomeFirstResponder() \(self.composeBar.textView.canBecomeFirstResponder())")
let res = self.composeBar.becomeFirstResponder()
print("composeBar.becomeFirstResponder() \(res)")
print("composeBar.isFirstResponder() \(self.composeBar.isFirstResponder())")
print("composeBar.textView.isFirstResponder() \(self.composeBar.textView.isFirstResponder())")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment