Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home Tips And Tricks iOS 8 – How To Develop A Custom Keyboard As An App Extension

iOS 8 – How To Develop A Custom Keyboard As An App Extension

Along with the superior tech specs iOS 8 has come up with an overwhelming list of features that made it stand ahead of its competitors. And, one of its interesting and fabulous features is that Apple has now enabled developers to launch their custom keyboards as app extension. Thereby, allowing users to choose their favorite custom keyboard (integrated in some application) and deploy it in other applications (that demands keyboard input) as well.

iOS 8 Custom Keyboard Tutorial

iOS 8 Custom Keyboard Tutorial

You can also reap the benefits of this amazing feature and create your application keyboard as an app extension. If you hire iPhone Application Development Services, you already gain a bona fide advantage. Here is a comprehensive guide to help you accomplish your task with ease.

In this article, we are considering the custom keyboard development as an app extension while deploying an Interface Builder document. This approach offers efficient results even if you are interested in creating a complex keyboard UI.

Let’s begin.

  • First of all, create a new iPhone Simple View Application. You can give a desired name to this container app, like First Custom Keyboard. According to the Apple’s protocol, all the featured extensions and some functions must be included in this container app.
  • Now, navigate to the project panel, select Project and click on Editor. After this, access the Add Target button and select iOS. Finally, select the Custom Keyboard as the Application Extension and click on the Next button.
  • Rename the product as “First Keyboard” and click on “Finish” button.
  • You can now insert the Text View to the main View and set it to the center.

To ensure that your keyboard is available in the list.

When the globe button is clicked from their default keyboard, a list of options will be represented. To add your keyboard to the list, you will need to make the following tweaks-

Navigate to the General Settings from the device and open the Keyboard options and click on Add New Keyboard option under the Keyboards tab. Now, from the available list of options simply choose your keyboard, here it is named as First Custom Keyboard.

By doing so, your custom keyboard will enter in the available list of keyboards. Select the globe button and switch to your keyboard.

After this, you get an empty screen boasting only a “Next Keyboard” button.

For adding desired keys in the keyboard via coding.

The hidden language of Computer Hardware & Software

The hidden language of Computer Hardware & Software

Access the KeyboardViewController.swift file and append the code for the Next Keyboard button in the viewDidLoad() method. This code will include the buttonTitles configuration, you may add a string of desired button titles that you want to view in your keyboard.

After doing this, create a function that will help you construct buttons for the titles added in the previous step. This function for creating buttons will need a string of titles as argument.

Once the appropriate buttons have been created, what’s left is defining the action to the buttons. Whenever a button is tapped, its corresponding keyPressed method will be called.

What’s next: Now, you will need to add constraints to the containingView and buttons, and this can be done efficiently via the method addConstraints(). You will need to pass two arguments to this method, one is buttons and another is the containingView.

Now, when you will run the keyboard after following all the four above mentioned steps properly, you can see the similar output on the screen as that is displayed in the image below.

Indubitably, you will get the desired result but the process is quite cumbersome. So, let’s move on to more convenient method, which can be accomplished via the Interface Builder document.

For adding desired keys in the keyboard via the Interface Builder document.

XCode iOS Interface Builder document

XCode iOS Interface Builder document

iOS - iPhone Simulator Custom Keyboard

iOS – iPhone Simulator Custom Keyboard

Go to File and create a New iOS File, and select the View option under the User Interface tab, by this you can create a nib file. Now, keeping the First Keyboard as the target, set the name of the file as Keyboard_View.

Make the following tweaks in the Attribute Inspector under the view of the nib file-

  • Size = Freeform
  • Status Bar = None

Under the Size Inspector, simply set-

  • width = 300
  • height = 200

Now, access the KeyboardViewController.swift file, add the following three lines of code after the call to super.viewDidLoad() method in the viewDidLoad() method in the file.

Code Snippet:

let nib = UINib(nibName: "Keyboard_View", bundle: nil)
let objects = nib.instantiateWithOwner(self, options: nil)
view = objects[0] as UIView;

What’s next: In the main view of the nib file, via the Interface Builder document, click on Pin and give the desired values to the associated constraints. Make the appropriate tweaks by adding the requisite number of buttons to the view, assigning them a text color value and titles.

You can set the other constraints for each button separately by simply entering a suitable value in the document against the appropriate fields. Once you are done with all the tweaks, it is recommended to update the frame by clicking on Editor in the main menu, then selecting the Resolve Auto Layout Issues tap on the All Views button and choose Update Frames. After doing so, when you will execute your application, you can witness a similar interface as shown in the following image.

Similarly, you can add other requisite buttons and functions to its actions to integrate superior functionality in your keyboard. If you Hire Skilled iPhone Programmers of excellent caliber, they are well versed with the exercise.

Ensure an intuitive and highly interactive interface, which can help deliver improved user experience (UX) and thus, compel them to switch to this keyboard and abandon the built-in keyboard. With these simple steps you can conveniently create a custom keyboard for iOS devices.

Nov 26, 2014Emily Heming
How To Change The DNS On iPhone - iPad A Walk Through The Changing Face Of Android
You Might Also Like:
  • Add And Get Custom Field In WordPress
  • View Download List In Google Chrome And Firefox
  • How to view PageRank, Bookmarks, Gmail button on Google Toolbar
  • Save Video File With Custom Name In CamStudio Recorder
  • Show Error Message On WordPress Custom Login Template Page
  • JQuery Get selected value of radio button
  • WordPress Get All Custom Fields
  • Add WordPress Login Form On Sidebar Or Custom Page
  • Create Amazon CloudFront With Your Own Domain And Own Files Server
  • View Email HTML Source In Microsoft Outlook 2007
Emily Heming

Emily Heming is a professional Blogger for one of the leading Mobile Development Company which offers you the facility to aid Mobile development services and also you can hire dedicated iPhone developers.

6 years ago Tips And Tricksapp extension, iOS, iPhone, xcode370
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
22,167 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
20,044 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
15,824 views
JQuery Allow only numeric characters or only alphabet characters in textbox
13,306 views
C# Read Json From URL And Parse/Deserialize Json
9,793 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • How to Compose Your Essay To Me – 4 Easy Steps to Write My Essay
  • How to Find a Photo Editor
  • Installment Loans – Making Sense of Online Software
  • Apple Pay Casino Canada
  • Casinos austria
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (28)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (105)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development