Skip to content

schrockblock/SBTextInputView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SBTextInputView

CI Status Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

To install SBTextInputView, simply add the following line to your Podfile:

pod "SBTextInputView", :git => 'https://github.com/schrockblock/SBTextInputView'

Usage

There are a couple options for using this view:

  1. Include it right in your xib/storyboard
  2. 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.

Author

Elliot Schrock

License

SBTextInputView is available under the MIT license. See the LICENSE file for more info.