Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

nomar383

macrumors 65816
Original poster
Jan 29, 2008
1,310
0
Rexburg, ID
Okay, so I have a NumPad keyboard that pulls up, but I need a period key. My idea was to create a UIButton over the top of the empty space on the bottom left of the NumPad. However, the button is always underneath the keyboard when it's pulled up. Any ideas?
 
You have a textfield in a view. Put the button in that same view next to it. When the user touches the textfield the keyboard appears. The keyboard only covers half the screen. You can still see the textfield and some space around it. Have the action of this button insert the dot into the textfield.

I have a UI where I show the URL keyboard. I have a couple buttons below the textfield that enter tilde and a file extension that is common for users of my app.

I guess I'm not sure what the number pad keyboard looks like. Does it cover the whole screen or just half like the URL keyboard?
 
The Numpad takes up the same space as every other keyboard, but only has 10 numbers and a backspace key.

I found a perfect solution for this, complete with pngs for the period from this blog:
http://billabonger.net/blog/2009/01/add-a-decimal-to-uitextfield-number-pad-keyboard/

It works great and the period looks very natural. It's a little crazy that this took nearly 50 lines of extra code. It should really be an option in IB for the Numpad keyboard.
 
Adding a subview to a view that you don't own is brittle. There are lots of things that can change that will prevent your code from working, not to mention crashing.

Up to you.
 
Yeah, it's a lot of lines of code that code break at some point, in fact I was surprised that is works flawlessly in 3.0.

I've decided to go with it and hopefully Apple will just add this option at some point and I can remove these extra steps.

If my program were more complex than a 3 input boxes and 1 view, I would have definitely gone your route
 
I submitted this as a feature request to Apple. I have already had to clean up the code a little to prevent multiple periods from being input.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.