- Why are you setting up your
textFieldsArray
intextFieldShouldReturn:
? Shouldn't this be done somewhere where initialization is done (e.g.viewDidLoad
of the view controller)? The problem might be that your array is never actually set up, or is only partly set up. Also, putting the setup here means it will be called over and over, mutating your array each time and screwing things up. - Your tags are off by one. You should be assigning them starting at 0, not 1 (or accounting for the difference in
inputAccessoryViewDidSelectNext:
). If your code was working, it would skip 2 text fields, as the first field would return tag 1, and you'd skip to objectAtIndex:2, which is the 3rd field. - You don't account for going off the end. If you're at the last field, incrementing will not go back to the beginning.
I'd actually recommend not using tags at all. Instead, at setup time, just loop through the fields adding them in order to your array. Then, in inputAccessoryViewDidSelectNext:
, use a counter instead of fast enumeration to figure out where you are.