To run the example project, clone the repo, and run pod install
from the Example directory first.
To install SBTextInputView, simply add the following line to your Podfile:
pod "SBTextInputView", :git => 'https://github.com/schrockblock/SBTextInputView'
There are a couple options for using this view:
- Include it right in your xib/storyboard
- Use the specialized init method
The first option is pretty self explanatory. For the second, just do something like:
[[SBTextInputView alloc] initWithFrame:CGRectMake(x, y, width, height) superView:self.view delegate:self];
(You can check out the Example folder for more.)
Then, when you want to show the keyboard, just call becomeFirstResponder
on the instance. To hide it, resignFirstResponder
.
If you'd like to make this an inputAccessoryView of something else, just pass in nil
for the superView param in the constructor, and treat it like any other view.
All the subviews are exposed properties, so you can style them any way you'd like. The background is a lightweight subclass of UIToolbar
which overrides some of its more annoying behavior.
You might also like to edit the text programmatically (perhaps reseting the text to @"") and have the view size appropriately. To do this, just set the inputTextView.text as desired, then call notifyTextChanged
on the SBTextInputView
.
Elliot Schrock
SBTextInputView is available under the MIT license. See the LICENSE file for more info.