• This repository has been archived on 19/Aug/2020
  • Stars
    star
    528
  • Rank 80,843 (Top 2 %)
  • Language
    Objective-C
  • License
    Other
  • Created over 12 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Put controls above the keyboard on your iPhone or iPad app.

Introduction

BSKeyboardControls makes it easy to add an input accessory view above the keyboard which allows to go to the previous and next text fields as well as close the keyboard. Much like it is seen in Safari on iOS.

  • iPhone and iPad compatible
  • Requires iOS 5+
  • Uses ARC

Installation

The easiest way to use BSKeyboardControls is to copy the files in BSKeyboardControls/ into your Xcode project.

  1. In Finder, navigate to your BSKeyboardControls directory
  2. Drag the complete directory into Xcode

OR

  1. Add pod 'BSKeyboardControls', '~> 2.2' to your Podfile

Usage

Wherever you want to use BSKeyboardControls import BSKeyboardControls.h like this:

#import "BSKeyboardControls.h"

Now you will have to set up BSKeyboardControls. This is done in five easy steps:

  1. Initialize the keyboard controls
  2. Set the delegate of the keyboard controls
  3. Add all the fields to the keyboard controls (The order of the fields is important)
  4. Set the delegate of all the text fields

Below is an example on how to setup the keyboard controls. The below example assumes the the text fields and the text views have had their delegate set in Interface Builder.

NSArray *fields = @[ self.textFieldUsername, self.textFieldPassword,
                     self.textFieldRepeatedPassword, self.textViewAbout,
                     self.textFieldFavoriteFood, self.textFieldFavoriteMovie,
                     self.textFieldFavoriteBook, self.textViewNotes];

[self setKeyboardControls:[[BSKeyboardControls alloc] initWithFields:fields]];
[self.keyboardControls setDelegate:self];

Next you will have to set up the delegation methods. BSKeyboardControls requires three delegates: BSKeyboardControlsDelegate, UITextFieldDelegate and UITextViewDelegate.

First you want to close the keyboard if the user presses the "Done button".

- (void)keyboardControlsDonePressed:(BSKeyboardControls *)keyboardControls
{
	[keyboardControls.activeField resignFirstResponder];
}

Next you want the view to scroll whenever a field is selected. There are a lot of ways to do this and you may have to tweak this.

- (void)keyboardControls:(BSKeyboardControls *)keyboardControls selectedField:(UIView *)field inDirection:(BSKeyboardControlsDirection)direction
{
	UIView *view = keyboardControls.activeField.superview.superview;
    [self.tableView scrollRectToVisible:view.frame animated:YES];
}

This is all there is for the BSKeyboardControlsDelegate. Now you want to set up the UITextFieldDelegate. The only method required is - (void)textFieldDidBeginEditing:

- (void)textFieldDidBeginEditing:(UITextField *)textField
{
	[self.keyboardControls setActiveField:textField];
}

Next you set up the - (void)textViewDidBeginEditing: method of the UITextViewDelegate. This is similar to the UITextFieldDelegate.

- (void)textViewDidBeginEditing:(UITextView *)textView
{
	[self.keyboardControls setActiveField:textView];
}

Now you are ready to use BSKeyboardControls. For more information on how to use BSKeyboardControls, please see Example.xcodeproj.

More Repositories

1

Runestone

📝 Performant plain text editor for iOS with syntax highlighting, line numbers, invisible characters and much more.
Swift
2,301
star
2

SBSAnimoji

🐵 Animoji app using Apples AvatarKit
Objective-C
985
star
3

KeyboardToolbar

⌨️ Add tools above your keyboard with iOS-like keyboard buttons.
Swift
219
star
4

dependency-graph

🕸️ dependency-graph is a command-line tool that can visualize the dependencies of packages.
Swift
164
star
5

SBSCustomAnimoji

🐶 Custom Animoji using Apples AvatarKit
Objective-C
106
star
6

xctemplates

⚙️ Opinionated Xcode templates
Shell
94
star
7

darkdocs

Safari extension that adds support for dark mode in Apple’s developer documentation.
CSS
73
star
8

InfiniteCanvas

🖌 Infinite canvas using PencilKit
Swift
65
star
9

alfred-youtube-workflow

A workflow for Alfred 2.0 which lets the user search for YouTube videos and have them returned to Alfred.
Python
54
star
10

alfred-tweetbot-workflow

Control Tweetbot from Alfred 2.0
Python
44
star
11

Prettier

✨ Wrapper for the Prettier code formatter written in Swift
Swift
44
star
12

thingsapp

Node module for creating todos in Things.app
JavaScript
38
star
13

BSPanViewController

A take on the sliding controllers which can optionally move the status bar along with the main view.
Objective-C
36
star
14

Temperatus

A Mac application which shows the current temperature using a Thermodo device
Objective-C
35
star
15

TreeSitterLanguages

Languages for Tree-sitter wrapped in Swift packages
C
33
star
16

alfred-safari-tabs-workflow

Manage tabs in Safari
Python
22
star
17

ios-widget-sizes

The sizes of widgets for select iPhones and iPads.
19
star
18

alfred-movies-workflow

Lookup movies on IMDb and OMDb
Python
17
star
19

homebridge-roomba

Roomba plugin for Homebridge
JavaScript
15
star
20

AppleFeedback

💬 Sample projects submitted to Apple Feedback
Swift
15
star
21

appiconset-creator

Creates .appiconset directories for iOS projects
JavaScript
15
star
22

homebridge-samsungtv

Samsung TV plugin for homebridge.
JavaScript
14
star
23

alfred-cloudapp-workflow

CloudApp workflow for Alfred 2.0 which allows for managing uploads.
Python
14
star
24

BuildABuddyKit

Learning material guiding the reader through documenting their project using Apple's DocC tool.
Swift
12
star
25

samsungtv

Node module for controlling a Samsung TV.
JavaScript
11
star
26

dotfiles

My dotfiles.
Python
10
star
27

Knob

Volume knob for Beoplay speakers
Swift
10
star
28

simonsays

Simon Says for your touch bar.
Swift
10
star
29

CharlesTVDB

A collection of classes for OS X and iOS which provides a block based interface for TheTVDB which is extremely easy to use.
Objective-C
10
star
30

synology-diskstation

Turn on and off a Synology DiskStation
JavaScript
10
star
31

Emcee

Shows the song currently playing in Spotify, Rdio or iTunes.
Swift
10
star
32

ImmersiveMoveAndRotate

Example project showing how an immersive scene on visionOS can contain a RealityView that presents a ModelEntity and how that entity can be dragged using DragGesture and rotated using RotateGesture.
Swift
9
star
33

ColoredTunes

Uses the artwork of the song currently playing in Spotify to change the color of your Philips Hue light bulbs.
Objective-C
6
star
34

BSSwipeTableViewCell

A very customizable table view cell which can be swiped left and right.
Objective-C
6
star
35

Charles

Charles helps you rename your video files and subtitles using data from TheTVDB.
Objective-C
6
star
36

install-op-cli

GitHub Action to install a specified version of the 1Password CLI.
HTML
5
star
37

spotify-controls-api

Simple API for controlling Spotify from other services.
JavaScript
5
star
38

SBSAnimojiRecording

🐨 Proof of concept showing how to overlay an Animoji on top of a camera feed using ARKit
Objective-C
5
star
39

jodelihood

Creates a map with posts from the Jodel community in your neighbourhood.
CSS
5
star
40

findemoji

Slå op i Fødevarestyrelsens kontrolrapporter og find en passende emoji
JavaScript
4
star
41

ThermoWallpaper

An OS X application which sets the desktop wallpaper to a Thermo thermometer showing the current temperature.
Objective-C
4
star
42

Cursor

Trigger an action when device is pointing at a known location.
Swift
3
star
43

alfred-rap-genius-workflow

Look up a song on Rap Genius from Alfred
3
star
44

SnapKit

A Swift Autolayout DSL for iOS & OS X
Swift
3
star
45

Edinem

Editor for Charles session files built on Electron using React
JavaScript
2
star
46

dr-tv-player

OS X app for viewing DR TV live streams. Fast.
Swift
2
star
47

SwiftGen

The Swift code generator for your assets, storyboards, Localizable.strings, … — Get rid of all String-based APIs!
Swift
2
star
48

comedy-festival-api

Scrapes shows for the Comedy Festival
JavaScript
2
star
49

findemoji-ios

The Smileyordning is boring. The Emojiordning is more fun.
Swift
2
star
50

forspeciale

Forspeciale, Embedded and Distributed Systems, AAU 2015
TeX
2
star
51

alfred-lyricsfinder-workflow

A workflow for Alfred 2.0 which lets you quickly find lyrics for the song currently playing in Spotify.
Python
2
star
52

comedyfestival

Unofficial Comedy Festival app.
Swift
2
star
53

atju

iOS app for viewing pollen readings from DMI.
Swift
2
star
54

alfred-drtv-workflow

A workflow to browsing and downloading programs from DR TV.
Python
2
star
55

context-aware-home-automation

Context aware home automation based on the users position and motion gestures.
Java
1
star
56

roomba

Node module for controlling a Roomba vacuum cleaner.
JavaScript
1
star
57

speciale

Master's thesis at the Distributed and Embedded systems unit, Aalborg University, Denmark
TeX
1
star
58

BSConfig

Manage configurations in a property list.
Objective-C
1
star
59

docs.runestone.app

📖 Documentation for Runestone hosted on docs.runestone.app
HTML
1
star
60

pawawax

tvOS parallax on arbitrary views
Swift
1
star
61

WordbaseCheater

C++
1
star
62

atju-backend

Polls for pollen readings from DMI and stores them.
JavaScript
1
star
63

google-home-calendar-refresh

Copies calendar events into a primary Google calendar from iCal feeds thereby making it possible for a Google Home to read the calendar events.
JavaScript
1
star