Code Monkey home page Code Monkey logo

ackeyboard's Introduction

ACKeyboard

ACKeyboard is a keyboard extension for iOS that mimics the system keyboard, except it has only one 'letter' key: "yo".

Build Status

screenshots

Description

The project contains two targets:

  • the keyboard extension
  • an application to test the keyboard with different settings

The keyboard has the following features:

  • iPhone and iPad layout
  • portrait and landscape support
  • light and dark appearances
  • capitalization
  • repeat delete
  • end of line punctuation
  • auto-enable return key

The keys have the following features:

  • drawn with core graphics
  • light, dark, blue (for enter key) styles
  • regular and lock (shift) keys
  • different per-device color sets

See my post about ACKeyboard for more details.

Screenshots

iPhone portrait:

screenshots

iPhone landscape:

screenshots

iPad portrait:

screenshots

Demo

Run the demo application in the iOS simulator to try it out.

To enable the keyboard, open the Settings app and go to:

General > Keyboard > Keyboards > Add New Keyboard... > ACKeyboard

Extending and making your own keyboard

Keys

To make a key with a title:

ACKey *key = [ACKey keyWithStyle:ACKeyStyleLight
                      appearance:ACKeyAppearanceLight
                           title:@"A"];

or to make a key with a picture:

ACKey *key = [ACKey keyWithStyle:ACKeyStyleLight
                      appearance:ACKeyAppearanceLight
                           image:[UIImage imageNamed:@"global_portrait"]];

being a UIControl subclass, a target-action can be associated to the key for an event:

  [key addTarget:self
          action:@selector(keyTapped:)
forControlEvents:UIControlEventTouchUpInside];

and the key can be added as a subview:

key.frame = phoneKeyboardMetrics.frame;
[self.view addSubview:key];

The ACLockKey is a special key that can be locked, like the "shift" key. An image for the lock state can be specified:

lockKey.lockImage = [[UIImage imageNamed:@"shift_lock_portrait"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];

and it can be locked with, for instance a double tap:

...
    [lockKey addTarget:self action:@selector(shiftButtonTapped:)
      forControlEvents:UIControlEventTouchDown];
    [lockKey addTarget:self action:@selector(shiftButtonDoubleTapped:)
      forControlEvents:UIControlEventTouchDownRepeat];
...

- (void)shiftButtonDoubleTapped:(ACLockKey*)lockKey {
    lockKey.locked = ! lockKey.isLocked;
}

Metrics

iPhone and iPad keys layout are defined in PhoneKeyboardMetrics.h and PadKeyboardMetrics.h. All the calculation is done manually, without autolayout, to prevent some occasional jerkiness.

The dimensions are calculated by doing linear interpolation:

    CGFloat letterKeyWidth = LINEAR_EQ(keyboardWidth,
                                   kPhoneKeyboardPortraitWidth, 26.0,
                                   kPhoneKeyboardLandscapeWidth, 52.0);

where, here, 26.0 and 52.0 are measured key width for portrait and landscape.

Appearance

The keyboard implements a light and dark appearance (ACLightAppearance and ACDarkAppearance).

The color sets can vary with the device type. The device can be checked with the UIDevice+Hardware category:

if ([[[UIDevice currentDevice] machine] hasPrefix:@"iPhone4,1"]) {
    blueKeyColor = [UIColor colorWithRed:9/255.0
                                   green:126/255.0
                                    blue:254/255.0
                                   alpha:1.0];
    
}

Documentation

If you have appledoc installed, you can generate the documentation by running the corresponding target.

ackeyboard's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ackeyboard's Issues

iOS 8.1 Simulator unable to load Keyboard Extensions

While this isn't an issue with ACKeyboard, I thought it would be worth creating one because I'm sure others will run into this.

I was unable to select ACKeyboard in iOS Simulator, even after enabling it through Settings-> General-> Keyboard-> Add New Keyboard.

Apparently (according to this SO post), iOS keyboard settings are not applying to most apps in the iOS Simulator, which means that it is impossible to load a custom keyboard extension (or even a system keyboard extension), or (more importantly) debug keyboard extensions in containing apps.

Supposedly it is possible to load those keyboard extensions in Calendar, Maps, etc, but obviously these apps do not provide a debugging environment. In testing with Spotlight and Calendar, ACKeyboard is displayed as a selection, but after attempting to load the view, the system skips over it and loads the next keyboard. Obviously I am unable to debug what is happening there.

On-device, the keyboard loads perfectly fine, and debugging is totally possible. Until this issue gets resolved in iOS 8.2 (or later), it looks like we are limited to testing on-device.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.