Ok, I’m in the process of developing my first iPad application. Yea I’m a newbie. I’m running into a number of problems implementing properties even though I’m using the exact same code as I used for the iPhone. I thought the two platforms were (are) the same iOS? For example, I can not set the Keyboard type for a UITextField either directly through Storyboard or programmatically. Here’s what I’ve done:
- storyboard
keyboard = number pad
- programmatically
header
IBOutlet UITextField *txtValue;
@property (nonatomic, retain) UITextField *txtValue;
implementation
@synthesize txtValue;
txtValue.keyboardType = UIKeyboardTypeNumberPad;
I also tried:
[txtValue setKeyboardType:UIKeyboardTypeNumberPad];
Also there is an active IBOutlet for the UITextField between the ViewController screen and ViewController file in the Connections Inspector and the User Interaction enabled is checked.
There’s absolutely nothing wrong with the default keyboard other than the fact that it’s not what I want. Any idea what is going on here? Thanks…
I think I know what the answer is and it’s pretty dumb. The answer is, there only is one keyboard on an iPad. The property only sets the configuration when it is opened. So if you set the Keyboard to NumberPad, the same keyboard opens up with the numbers showing. Not sure I like this.
That keyboard is not available on the iPad.
If you do not like the standard keyboard, I’d recommend you look into creating your own custom keyboard. Here is a document to help get you started:
http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/InputViews/InputViews.html#//apple_ref/doc/uid/TP40009542-CH12-SW2
All things considered, a custom iOS keyboard isn’t as hard as it sounds. It’s just another custom view. The hardest part is making some graphics to make it look the way you want.
If the custom route is not what you’re looking for, there are also several “custom” keyboard people have already made. Checkout github or CocoaControls. Here is just one example of a custom number pad someone’s made for the iPad:
https://github.com/azu/NumericKeypad