New issue
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
Added Input Accessory View Support #16
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of ideas on how to minimize boilerplate on developer's side.
Typist/ViewController.swift
Outdated
@@ -16,7 +16,7 @@ class ViewController: UIViewController { | |||
didSet { | |||
tableView.tableHeaderView = UIView() | |||
tableView.tableFooterView = UIView() | |||
tableView.keyboardDismissMode = .interactive // allow dismissing keyboard interactively | |||
tableView.keyboardDismissMode = .interactive // allows dismissing keyboard interactively |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be assigned on in didSet
of keyboard's scrollView
, this keeping boilerplate a bit more lean on developer's part. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
Typist/ViewController.swift
Outdated
keyboard.on(event: .willChangeFrame) { [unowned self] options in | ||
let height = UIScreen.main.bounds.height - options.endFrame.origin.y | ||
self.bottom.constant = max(0, height - self.toolbar.bounds.height) | ||
// UIView.animate(withDuration: options.animationDuration, delay: 0, options: UIViewAnimationOptions(curve: options.animationCurve), animations: { | ||
UIView.animate(withDuration: 0) { | ||
self.tableView.contentInset.bottom = max(self.toolbar.bounds.height, height) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could include all of those recalculated values in options
if possible? Another idea—pass toolbar configuration to keyboard and options will provide all the geometry pre-recalculated as CGRect
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main issue revolves around the toolbar height being included in the keyboard height. We need to figure out how to make this easier to handle.
Another one, say we have new configuration method called
Not sure about the name of the |
@efremidze Will you experiment with |
Yes Ill look into it tomorrow |
Can you PR this to different |
Awesome, thanks! Let's carry on on this branch and I'll merge it with master when all is neat and tidy. |
Added input accessory view support (#15) by adding a
scrollView
property to track panning. You also need to set theinputAccessoryView
on the textField.Observes the input accessory view through the
willChangeFrame
anddidChangeFrame
observer.Demo has been updated to reflect the changes.
Im also considering an alternative implementation like BABFrameObservingInputAccessoryView.