Re: UITextField Questions
Re: UITextField Questions
- Subject: Re: UITextField Questions
- From: Conrad Shultz <email@hidden>
- Date: Mon, 25 Jul 2011 18:19:09 -0700
Take a look at UITextInputTraits to specify a numeric keyboard. (IIRC this can be done in IB too.)
Take a look at UITextFieldDelegate's textFieldShouldEndEditing: method to perform validation of input.
I should also point out that often a text field is not the most appropriate control for restricted numeric input. If you have a reasonably small finite set of input values, consider UIPickerView. If you have a finite range for input, consider UISlider.
(Sent from my iPhone.)
--
Conrad Shultz
On Jul 25, 2011, at 18:09, Brooke Gravitt <email@hidden> wrote:
> Hello,
>
> I have a question about UITextField -
>
> How might I restrict/correct user input that is numerical? For
> instance, I would like the input to only be numbers, and to have an
> upper bounds.
>
> If a user inputs any non-numerical input, I want to send a message to
> the UITextField to set itself back to a default value.
>
> I'd also like to prevent users from putting a gazillion zeros in for
> some ridiculous numbers. Maybe cap it at 10^7.
>
> Any hints?
>
> Thanks in advance!
>
> Brooke
> _______________________________________________
>
> 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
_______________________________________________
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