views:

683

answers:

1

I want to limit the length of a textfield, so that a user can know how many characters he can input. But I find no such attributes of textfield on iPhone. Any ideas how to do this?

And how to switch from one textfield to another when it reaches its max length? (to let users type easily)

A: 

You might check out the UITextFieldDelegate protocol, specifically textField:shouldChangeCharactersInRange:replacementString:. You could check if your text field has reached it's maximum size, and if so move to the next appropriate text field by sending it becomeFirstResponder:

drewh