Re: How to set keyboard type for custom view?
Re: How to set keyboard type for custom view?
- Subject: Re: How to set keyboard type for custom view?
- From: Jeffrey Walton <email@hidden>
- Date: Tue, 31 May 2011 17:42:54 -0400
On Tue, May 31, 2011 at 3:49 PM, Conrad Shultz
<email@hidden> wrote:
> -----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:
>
> [SNIP]
>
> 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).
Thanks Conrad. We had essentially the same code. `rm -rf build/` fixed it.
Jeff
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden