[iOS] Add customized buttons and toolbars to your UITextInputs.

Overview

RFKeyboardToolbar
RFGravatarImageView Version License MIT reposs

This is a flexible UIView and UIButton subclass to add customized buttons and toolbars to your UITextFields/UITextViews. This project was inspired by the toolbar seen in iOctocat.

Installation

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like RFKeyboardToolbar in your projects.

Podfile

platform :ios, '7.0'
pod "RFKeyboardToolbar", "~> 1.3"

Installation without CocoaPods

Just drag the RFKeyboardToolbar folder into your project and import it.

#import 'RFKeyboardToolbar.h'

Use

RFKeyboardToolbar is pretty easy to use with your UITextFields or UITextViews. After you've imported RFKeyboardToolbar, you can add a toolbar to anything that has an inputAccessoryView.

I've commented on the initialization below, to help you get a better understanding of it.

// Create a new RFToolbarButton
RFToolbarButton *exampleButton = [RFToolbarButton buttonWithTitle:@"Example"];

// Add a button target to the exampleButton
[exampleButton addEventHandler:^{
    // Do anything in this block here
    [_textView insertText:@"You pressed a button!"];
} forControlEvents:UIControlEventTouchUpInside];

// Create an RFKeyboardToolbar, adding all of your buttons, and set it as your inputAcessoryView
_textView.inputAccessoryView = [RFKeyboardToolbar toolbarWithButtons:@[exampleButton]];

// Add the UITextView/UITextField
[self.view addSubview:_textView];

Hope you enjoy it! Please Fork and send Pull Requests!

Screenshots

RFMarkdownTextView

Contributors

License

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

Comments
  • Make the buttons center-aligned

    Make the buttons center-aligned

    Is there a way to make the buttons center aligned? Right now, all the buttons are on the left (left aligned). People have to move their hands a lot to tap on them on a really wide screen.

    opened by Sweeper777 12
  • More Simplification

    More Simplification

    I believe this is as simple as it can get. It removes the button having a textField/textView/searchBar property but I don't believe it should be the buttons job to know that. Let me know what you think.

    enhancement 
    opened by Hackmodford 7
  • Simplifying codebase

    Simplifying codebase

    I think the changes I have made simplify the code. In particular button creation. You can now create a button title without subclassing. I have made use of blocks instead of subclassing the button. Let me know what you think.

    opened by Hackmodford 5
  • Add changeable buttons property and (optionally) animate button changes

    Add changeable buttons property and (optionally) animate button changes

    This adds a buttons property to RFKeyboardToolbar that can be used to change the buttons, and a setButtons:animated: variant that can animate the button changes. The demo is updated accordingly, to add a button for each distinct word in the field.

    opened by zydeco 3
  • The user has to tap on the spacing between the buttons to scroll.

    The user has to tap on the spacing between the buttons to scroll.

    I have many buttons on my toolbar, when I try to scroll it, I found that I cannot scroll it unless I start my touch on the the little spaces between the buttons, otherwise the button that I touched will be pressed.

    Can this somehow be handled? If the gesture is a pan, can the button not be triggered and instead the toolbar will scroll?

    opened by Sweeper777 2
  • Spacing of items in toolbar

    Spacing of items in toolbar

    Is it possible to hardcode the position of the items in the toolbar?

    I'm thinking of something like this:

    Dynamic_string_button............................................Bold...Italic... The Dynamic_string_button is used as a sort of pseudo autocorrect based on a prepopulated list of words (appears based on what the user types). Bold and Italic button are used to modify the textView.

    If the Dynamic_string_button doesn't match any keywords, then only Bold/Italic is shown, but they are still aligned to the right, so something like:

    .....................................................Bold....Italic

    opened by xiaosongshu 2
  • Use an image as the button?

    Use an image as the button?

    I want to use a picture of a slanted "I" as a button on the toolbar, like this:

    italic_000000_25

    I can't find any constructors that accept an image, so i tried this:

    let italicButton = RFToolbarButton(title: "", andEventHandler: { 
      // function
    }, for: .touchUpInside)!
    italicButton.setImage(UIImage(named: "italic"), for: .normal)
    italicButton.setImage(UIImage(named: "ialic"), for: .highlighted)
    textView.inputAccessoryView = RFKeyboardToolbar(buttons: [italicButton])
    

    But the button did not appear on the toolbar.

    opened by Sweeper777 2
  • Small Issues

    Small Issues

    Hello and thanks for the excellent library. There is a small issue in the example when in the viewdidload method you are calling a non existing method: this:

    [RFKeyboardToolbar addToolbarTo:_textView withButtons:@[exampleButton]];
    

    should be:

    [RFKeyboardToolbar addToTextView:_textView withButtons:@[exampleButton]];
    

    also on the RFExampleToolbarButton the

    [[RFToolbarButton textInput] insertText:@"Example text."];
    

    seems to be an unknown selector

    maybe what you wanted to have there is:

     [[RFToolbarButton textView] insertText:@"Example text."];
    

    thanks Konstantinos

    bug 
    opened by mythodeia 2
  • Fix warning about block declaration semantics

    Fix warning about block declaration semantics

    Hi! I've been using your library for a couple of years - it's great! I noticed that since Xcode 9, this code causes a warning related to block declaration semantics: This block declaration is not a prototype. The fix appears to be simple. Hope you won't mind accepting this PR!

    opened by UberJason 0
  • Fix broken headings in Markdown files

    Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    opened by bryant1410 0
  • Content Inset not working on left side

    Content Inset not working on left side

    This may just be my issue, but it appears that the contentInset is not being set initially when adding a lot of buttons, or possible one button (untested).

    See this demo screenshot:

    You are able to scroll, and when scrolling back, you get the proper contentInset, however, not initially.

    bug 
    opened by ruddfawcett 0
Releases(v1.3)
⌨️ Add user-customizable global keyboard shortcuts to your macOS app in minutes

This package lets you add support for user-customizable global keyboard shortcuts to your macOS app in minutes. It's fully sandbox and Mac App Store c

Sindre Sorhus 1.1k Dec 29, 2022
Scribe-iOS is a pack of iOS and iPadOS keyboards for language learners

Scribe-iOS is a pack of iOS and iPadOS keyboards for language learners. Features include translation (beta), verb conjugation and word annotation that give users the tools needed to communicate with confidence.

Scribe 47 Jan 4, 2023
Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more.

IQKeyboardManager While developing iOS apps, we often run into issues where the iPhone keyboard slides up and covers the UITextField/UITextView. IQKey

Mohd Iftekhar Qurashi 15.9k Jan 8, 2023
KeyboardKit is a Swift library that helps you create custom keyboard extensions for iOS and ipadOS.

KeyboardKit is a Swift library that helps you create custom keyboard extensions for iOS and ipadOS.

KeyboardKit 900 Jan 9, 2023
iOS utility class allows you to access keyboard view and track keyboard animation.

YYKeyboardManager iOS utility class allows you to access keyboard view and track keyboard animation. (It was used by YYText) Compatibility iPhone / iP

null 480 Nov 17, 2022
A simple keyboard to use with numbers and, optionally, a decimal point.

MMNumberKeyboard A simple keyboard to use with numbers and, optionally, a decimal point. Installation From CocoaPods CocoaPods is a dependency manager

Matías Martínez 957 Nov 17, 2022
⌨️A Combine-based way to observe and adjust for Keyboard notifications in SwiftUI

⌨️ Keyboard Observing A Combine-based solution for observing and avoiding the keyboard in SwiftUI. Table of Contents About Requirements Installation C

Nick Fox 440 Jan 5, 2023
Prevent keyboard from covering UITextField/UITextView, includes Swift and Objective-C APIs

Prevent keyboard from covering UITextField/UITextView with only one line of code, includes Swift and Objective-C APIs.

LiuChang 8 Oct 24, 2022
Codeless manager to hide keyboard by tapping on views for iOS written in Swift

KeyboardHideManager KeyboardHideManager - codeless manager to hide keyboard by tapping on views for iOS written in Swift. Structure Features Requireme

Bondar Yaroslav 55 Oct 19, 2022
🎀 A simple cross-platform toolbar/custom input accessory view library for iOS & macOS.

Ribbon ?? A simple cross-platform toolbar/custom input accessory view library for iOS & macOS. Written in Swift. Looking for... A type-safe, XPC-avail

Chris Zielinski 294 Nov 28, 2022
Swift UIKit keyboard manager for iOS apps.

Typist Typist is a small, drop-in Swift UIKit keyboard manager for iOS apps. It helps you manage keyboard's screen presence and behavior without notif

Toto Tvalavadze 1.1k Dec 10, 2022
Best way to dismiss Keyboard in a View Controller iOS (Swift)

Best way to dismiss Keyboard in a View Controller iOS (Swift) First way: Implement UITextFieldDelegate’s textFieldShouldReturn method and dismiss curr

null 0 Dec 18, 2021
Objective-C library for tracking keyboard in iOS apps.

NgKeyboardTracker Objective-c library for tracking keyboard in iOS apps. Adding to your project If you are using CocoaPods, add to your Podfile: pod '

Meiwin Fu 808 Nov 17, 2022
A drop-in universal solution for moving text fields out of the way of the keyboard in iOS

TPKeyboardAvoiding A drop-in universal solution for moving text fields out of the way of the keyboard in iOS. Introduction There are a hundred and one

Michael Tyson 5.8k Dec 26, 2022
Emoji Keyboard SDK (iOS)

Makemoji SDK Makemoji is a free emoji keyboard for mobile apps. By installing our keyboard SDK every user of your app will instantly have access to ne

Makemoji 100 Nov 3, 2022
Awesome autolayout Toolbar. Toolbar is a library for iOS. You can easily create chat InputBar.

Toolbar This toolbar is made with Autolayout. It works more interactively than UIToolbar. Please Donate Slow Animations Debug mode If you want a Toolb

1amageek 459 Sep 16, 2022
A Chinese keyboard for iOS that helps Chinese language learners remember tones.

ToneBoard ToneBoard is a Chinese keyboard for iOS that requires you to enter the correct tones while typing simplified Chinese with Pinyin. It is avai

Kevin Bell 7 Sep 27, 2022
Slidden is an open source, customizable, iOS 8 keyboard, written in Swift

Slidden is an open source, customizable, iOS 8 keyboard, written in Swift. iOS 8 brought us the ability to create fully customizable keyboards, but do

Daniel Brim 595 Jan 5, 2023
Emoji Keyboard for iOS

English | 中文 An easy to use Emoji keyboard for iOS. Has been rewritten with swift, the old Objective-C version on branch oc. Features Written in Swift

isaced 450 Dec 24, 2022