Code Monkey home page Code Monkey logo

tikeyboardevents's Introduction

TiKeyboardEvents Module for Titanium

This module exposes some useful keyboard events available in iOS, used to notify the application when the keyboard is shown and hidden.

The module catches the UIKit keyboard notifications UIKeyboardWillShowNotification and UIKeyboardWillHideNotification, and fires these as the Titanium events keyboardWillShow and keyboardWillHide. For the keyboardWillShow event, the height of the keyboard is also passed along to allow apps to adjust the view to account for the visible keyboard.

More information about the iOS keyboard notifications can be found in Apple's UIKit documentation.

General information about developing and using Titanium modules is found in the Titanium docs.

Building

  1. Open the Xcode project and build as normal.
  2. Execute ./build.py to package the module as an archive.
  3. Copy the archive to the Titanium directory to make it available:
cp no.funkbit.keyboardevents-iphone-0.1.zip /Library/Application\ Support/Titanium/

Usage

Copy the module to your Titanium directory (e.g. /Library/Application Support/Titanium).

Add the module to your projects tiapp.xml:

<modules>
    <module version="0.1">no.funkbit.keyboardevents</module>
</modules>

Load the module in your application's app.js:

KeyboardEvents = require("no.funkbit.keyboardevents");

Bind to the events you are interested in:

KeyboardEvents.addEventListener("keyboardWillShow", function(e) {
    alert("Keyboard will show, with height=" + e.keyboardHeight);
});

KeyboardEvents.addEventListener("keyboardWillHide", function() {
    alert("Keyboard will hide");
});

tikeyboardevents'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

Watchers

 avatar  avatar  avatar

tikeyboardevents's Issues

Landscape mode returns 480 for height...

When I rotate the simulator, and load the keyboard it returns a height of 480 which is incorrect. It works fine in portrait mode tho.

Here's the event data:

{"source":
{"id":"no.funkbit.keyboardevents"},
"keyboardHeight":480,
"type":"keyboardWillShow"
}

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.