Skip to content
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

Option to remove / customize left / right buttons #1

Open
chadkouse opened this issue Feb 19, 2014 · 12 comments
Open

Option to remove / customize left / right buttons #1

chadkouse opened this issue Feb 19, 2014 · 12 comments

Comments

@chadkouse
Copy link

This is great, but I almost never need 2 buttons and it would be nice to be able to set a new button with my own style on it.

Do you have any interest in doing this or should I just make my own?

@chadkouse
Copy link
Author

FYI - I started this change.

@chadkouse
Copy link
Author

This turned into what feels like a complete hack... but it basically works.. https://github.com/chadkouse/RDRStickyKeyboardView

I'm not sure using 2 copies of the view is the best route to take.. makes this kind of thing very difficult.

@piercifani
Copy link

Yes, i'm having the same problems customising it. I took a different approach, using swizzling (!) to change the textView, leftButton and rightButton implementation of RDRKeyboardInputView in order to customise the look and feel. I'm also trying to make the keyboard appear and disappear programatically. When I'm done with all of that, I'll probably file a pull request

@datwelk
Copy link
Owner

datwelk commented Feb 22, 2014

I agree that with the current approach, customization is very hard. Before we improve it, we should decide on to what extent the control should be customizable. Would it be enough to make the buttons and textviews of one of the input views public (and subsequently synchronize changed properties with the dummy view)?

@dzenbot
Copy link
Contributor

dzenbot commented Mar 5, 2014

+1 to your solution @datwelk

@coduar
Copy link

coduar commented Mar 27, 2014

+1 to @datwelk solution. One last thing... it seems that I am not able to change the whole background of the underlying view. It would be nice it I could. I am already working with this component. @datwelk when are you planning to support customisations?

@coduar
Copy link

coduar commented Mar 27, 2014

Of course the same applies to customisation of the UITextView.

@datwelk
Copy link
Owner

datwelk commented Apr 3, 2014

Allright folks.. I finished a commit that allows for more customization. You can find it in the development branch (https://github.com/datwelk/RDRStickyKeyboardView/tree/development). It still needs some testing before being merged into master.

I will now try to explain what I have done. The inputView and dummyInputView properties have been renamed. Internally, there's now a inputViewScrollView and inputViewKeyboard property. The first is the one always situated at the bottom of the screen, right below the scrollview. The latter is the one that sticks to the keyboard. The inputViewScrollView property is exposed externally through the inputView property on RDRStickyKeyboardView.

Now the great thing is that the inputViewKeyboard property is lazily initialized as a visual copy of the inputViewScrollView property. This means that, through the public inputView property, you can make changes to inputViewScrollView, which will be reflected to inputViewKeyboard only if inputViewKeyboard has not yet been initialized. The initialization of inputViewKeyboard happens when the user has tapped inputViewScrollView's textView and the keyboard is about to appear.

If inputViewKeyboard already has been initialized, you can call invalidateInputView on your RDRStickyKeyboardView instance. The next time inputViewKeyboard will appear, it will look and act exactly like inputViewScrollView.

I believe this change forms a nice foundation on which we can build support for more extensive customizations, such as choosing whether or not to show the left and/or right buttons. Any thoughts?

@coduar
Copy link

coduar commented Apr 16, 2014

Hi @datwelk !

Could you merge this changes to master and also update Podspec file to incorporate this changes?

Cheers
Adam

@datwelk
Copy link
Owner

datwelk commented Apr 18, 2014

I am afraid I can't merge it yet, since there's still room for improvement. For example, it is now impossible to customize one of the two input views differenty than the other.

@Tommecpe
Copy link

Hello thanks for the hard work.
OK it is not yet fully customizable, but since nothing move 4 months, it could be interesting to merge what have been done, to the master ?

If it is stable enough of course !

@albertgh
Copy link

albertgh commented Sep 9, 2014

+1

For temporarily comment out line 392 and add this two lines after line 390, can hide the leftButton.

self.leftButton.hidden = YES;
visualFormat =  @"H:|-(==hor)-[textView]-(==hor)-[rightButton]-(==hor)-|";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants