UITextField-Navigation
UITextField-Navigation adds next, previous and done buttons to the keyboard for your UITextField
s and UITextView
s. It allows you to specify a next field either on the Interface Builder or programmatically. Then, you can access next and previous fields of each UITextField
or UITextView
easily.
The UI is highly customizable. RTL languages are supported.
To run the example project:
pod try UITextField-Navigation
Usage
Basic
You can set the nextNavigationField
property for each UITextField
and UITextView
either on the Interface Builder or programmatically. The previousNavigationField
property will be set on the other UITextField
or UITextView
automatically for you.
Example:
Please note that the nextNavigationField
and previousNavigationField
properties are not retained.
Capturing taps
To capture taps on the next, previous and done buttons, assign a delegate
to your NavigationField
, which is a UITextField
or UITextView
, also either on the Interface Builder or programmatically. Then implement the NavigationFieldDelegate
protocol (in addition to the UITextFieldDelegate
or UITextViewDelegate
protocol) for the delegate
.
Please note that you have to explicitly declare that the delegate
conforms to the NavigationFieldDelegate
protocol to make it work.
Swift:
Objective-C:
Set button titles
The titles of the previous, next and done buttons can be modified for each instant by setting the title
property of each corresponding button.
Or they can be set globally for all instances using Config
.
UI Customization
Using UIAppearance
Modify the appearance proxy of the NavigationFieldToolbar
and NavigationFieldToolbarButtonItem
classes to customize the navigation view's UI for all fields.
Directly and adding more buttons
Alternatively, you can directly modify the UI of each navigation view by accessing the navigationFieldToolbar
property of a UITextField
or UITextView
.
Installation
Carthage
Add the line below to your Cartfile:
CocoaPods
Add the line below to your Podfile:
Manually
- Download and drop
/UITextField-Navigation/Classes
folder in your project. - Congratulations!
Compatibility
- Swift 4, 5: please use the latest version
- Swift 3: please use version 3.0.0
- Swift 2: please use version 1.4.3
Apps that use UITextField-Navigation
Hello fellow developers. I can see that the library has been adopted in some apps. If your app also uses the library, it would be great if you can share it here. Please add it to the list below. Thanks!
License
UITextField-Navigation is available under the MIT license. See the LICENSE file for more info.