-
Notifications
You must be signed in to change notification settings - Fork 742
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
Overriding KeyboardTrackingView not useful since most functions and properties are private #482
Comments
That function is the core business logic of the component, so I wouldn't typically make that |
Hi, thanks for your swift reply. What I have tried now is override the topmargin property. In the getter I now calculate the topmargin with:.
This works well for the first time the top cell becomes first responder. What I need is access to the new height of the trackingview before the topmargin is applied in
If I can get the correct height of the trackingView, based on the the keyboardRect (depending on the keyboard type) and then calculate the topmargin, I think I can solve my problem. |
Just to throw in another option, add an open function which returns the topmargin
the default implementation would just return the topmargin property. the override implementation could return my calculated topmargin if needed, otherwise return super. This is probably too much tailored to my use-case. Therefore I was thinking of making the whole show function open, which would give complete control and access to the change and notification to any overriding class. |
Can you take a look at the branch I changed the timing of the following delegate method: func keyboardTrackingViewWillChange(change: KeyboardTrackingView.Change, userInfo: [AnyHashable : Any]) Now it is called before the height is calculated, giving you an opportunity to update If you prefer to subclass /// Subclasses can override this to do something before the change.
open func willChange(
change: KeyboardTrackingView.Change,
userInfo: [AnyHashable : Any]
) {} |
This works great for me. |
@wtmoose could you please release this? Since I am using a podspec I cannot set a branch. |
Done. |
Hi,
I'm using SwiftMessages to show a popup with a form.
Since some of the inputs are pushed above the screen I am trying to override the KeyboardTrackingView so that I can calculate the topmargin myself to make sure each input is visible when it becomes first responder.
I'm most interested in
private func show(change: Change, _ notification: Notification)
Could you make this function open?
Since I am using this library in a podspec, it's not easy to make this change for myself.
The text was updated successfully, but these errors were encountered: