Latest 1.1.2
License MIT
Platforms ios 10.0

CI Status

Easy way to add accessory input view to custom input tool bar.


Typically in chat page or comment page of the app, you will need to attach an input tool bar to the bottom of the view. This input tool bar will contain a textfield and a button. Sometimes you will find writing chat messages or comments not enough, you will probably want to send stickers, payments, contact info, location info, etc. The easiest way you would do is to add an extra button to the input tool bar and connect it to an action sheet. With this category, you can do more than that, just design an input view and tell the ViewController your input view.



YTPAccessoryInputView requires iOS 10.0 or later.

Using CocoaPods

  1. Simply add the following line to your Podfile:
pod "YTPAccessoryInputView"
  1. Run pod install and then open your project’s .xcworkspace file to launch XCode.
  2. Put @import YTPAccessoryInputView; in the ViewController containing your TableView or CollectionView where you want to add accessory input view.


Imagine you already connected your input tool bar, input tool bar button, and the bottom layout constraint.

@property (weak, nonatomic) IBOutlet UIView *chatInputToolBar;  // Your tool bar 
@property (weak, nonatomic) IBOutlet UIButton *chatInputToolBarButton;  // Button in your tool bar to bring accessory input view up
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bottomConstraint;  // Constraint from input tool bar to the bottom of the view

Now tell your view controller the custom input view you want to use.

UIView *inputView = [[[NSBundle mainBundle] loadNibNamed:@"YourInputView" owner:self options:nil] firstObject];
self.accessoryInputView = inputView;

self.inputToolBar = self.chatInputToolBar;
self.inputToolBarBottomSpace = self.bottomConstraint;

Then configure your input view with following call

[self ytp_configureAccessoryInputView];

Next step is to connect the button to trigger your custom input view. In the IBAction of your button, add following

[self ytp_toggleAccessoryInputViewWithButton:self.chatInputToolBarButton];

If you want dissmiss keyboard or your custom accessory input view, for example

[self ytp_dismissKeyboardOrAccessoryInputView];

Finally, you need to call the clean up method which dismisses keyboard observers. The ideal place to put it is in viewDidDisappear.

[self ytp_resetViewControllerStatus];

That’s it!!


carlpan, [email protected]


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

Latest podspec

    "name": "YTPAccessoryInputView",
    "version": "1.1.2",
    "summary": "A category that adds accessory input view to custom input tool bar.",
    "description": "YTPAccessoryInputView is a simple library for iOS. If you ever wanted to add extra functionalities to your nchat or comment page with your custom input tool bar, for example, adding a scroll view with custom stickers or nsending photos or location info. This library can easily allow toggle between keyboard and the accessory input view. nWith this library, you no longer need to rely on UIAlertController to create action sheet for extra functionalities.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "carlpan": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.1.2"
    "platforms": {
        "ios": "10.0"
    "source_files": "YTPAccessoryInputView/Classes/**/*"

Pin It on Pinterest

Share This