Additional toolbar on top of keyboard (iPhone)

Some apps – like Twinkle – have an additional toolbar on top of the keyboard. In most cases they host buttons like "Done" or "Send" because the built-in keyboard simply does not allow to customize in any way not pre-thought by Apple.

Question: Is there a standard way of adding such a toolbar? Can anybody provide a link or code snippet?

iMac, Mac OS X (10.5.4), iPhone 16GB, iPhone 3G 16GB, Apple Firmware 2.1 | www.treealitygroup.com

Posted on Nov 8, 2008 8:45 AM

Reply
1 reply

Nov 8, 2008 3:20 PM in response to BeSharp

Here's what I would do. Create a UIToolbar with whatever you want inside of it. Hide the tool bar beyond the edge of the screen by setting the frame at (0.0, 480.0, width, height).

Then whenever the keyboard comes up, transform the toolbar at the same speed as the keyboard so that it sits above the keyboard.

The keyboard is 216.0 high and transforms in about 0.3 seconds, so you want something like this:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0, -216.0);
myToolbar.transform = transform;
[UIView commitAnimations];

Good luck.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Additional toolbar on top of keyboard (iPhone)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.