-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 5/31/11 12:23 PM, Jeffrey Walton wrote: > Hi All, > > I have a view that accepts input using UIKeyInput. The VC's > viewWillAppear: calls [myHiddenView becomeFirstResponder] which shows > the alphanumeric keyboard. I get input as expected through insertText: > and deleteBackwards:. > > How does one change the keyboard type to UIKeyboardTypeNumberPad? I've > tried conforming to UITextInputTraits in my custom view, but the > keyboard does not appear to reach back to my view for the trait. Is > there anything special when a protocol only includes properties? Or > perhaps I have missed another [important] detail?
Can you show code? I ask because I just implemented a minimal example that I believe does what you are asking, with nothing fancy. I did not implement the backing store for UIKeyInput, but I don't see that that should matter here. In a UIView subclass (declared with <UITextInputTraits, UIKeyInput>) I implemented: - - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [self becomeFirstResponder]; } - - (BOOL)canBecomeFirstResponder { return YES; } #pragma mark UIKeyInput methods - - (void)deleteBackward { } - - (void)insertText:(NSString *)text { } - - (BOOL)hasText { return NO; } #pragma mark UITextInputTraits methods - - (UIKeyboardType) keyboardType { return UIKeyboardTypeNumberPad; } And, as expected, when I tapped the UIView (in simulator), the numeric keypad appeared. This sounds like what you did, though...? The only thing I could think of is that your view controller is interfering, but the view comes before its controller in the responder chain, so it's not clear how this would happen (barring some very unorthodox implementation). - -- Conrad Shultz Synthetiq Solutions www.synthetiqsolutions.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iD8DBQFN5UY3aOlrz5+0JdURAjCKAJ4okqU/1NYWelDbWvXJ+/Qk5cFR+gCfZmzt A2LxTk3sa3kuVVVXpYa1k8Y= =ONTG -----END PGP SIGNATURE----- _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com