Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Farani

macrumors 6502
Original poster
Oct 21, 2007
267
0
I have a table populated with UItextfield objects and I'd like to implement the "Next" button on the keyboard so that when it is pressed the next textField in the table goes into editing mode. I've tried everything I can think of and I haven't been able to find anything in the documentation thus far. Any ideas? Thanks.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
So you have set the return key type to UIReturnKeyNext right? Does the UITextField delegate method

Code:
- (BOOL)textFieldShouldReturn:(UITextField *)textField

not get called when the "return" (really Next) button gets pressed? Assuming it does (it should) just return NO and do what you want to do instead...
 

Farani

macrumors 6502
Original poster
Oct 21, 2007
267
0
So you have set the return key type to UIReturnKeyNext right? Does the UITextField delegate method

Code:
- (BOOL)textFieldShouldReturn:(UITextField *)textField

not get called when the "return" (really Next) button gets pressed? Assuming it does (it should) just return NO and do what you want to do instead...

It does get called. My problem isn't that, it's that I don't know how to programmatically start editing on another text field. I know where I need to implement this, I just don't know how to do it.

EDIT: Thank you so much for the response!
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
It does get called. My problem isn't that, it's that I don't know how to programmatically start editing on another text field. I know where I need to implement this, I just don't know how to do it.

EDIT: Thank you so much for the response!

Sorry. You didn't say that. This is a perfect example of why people should post code.

Assuming you have a reference to the UITextField you wish to start editing in you should simply be able to send it a becomeFirstResponder message. From the UIResponder documentation for becomeFirstResponder:

"Sending this message to a view object, for example a UITextField instance, will cause it to become the first responder and begin editing."

It really is all in the documentation...
 

Farani

macrumors 6502
Original poster
Oct 21, 2007
267
0
Sorry. You didn't say that. This is a perfect example of why people should post code.

Assuming you have a reference to the UITextField you wish to start editing in you should simply be able to send it a becomeFirstResponder message. From the UIResponder documentation for becomeFirstResponder:

"Sending this message to a view object, for example a UITextField instance, will cause it to become the first responder and begin editing."

It really is all in the documentation...

Sorry. I kept my question broad initially because I thought maybe there was an easier way. I really didn't want to post here; I assumed it was in the doc and I was just missing it. Sorry for the bother and thank you for taking the time to respond. I really appreciate it.

- Ryan

PS Do you own a Lotus?
 

Farani

macrumors 6502
Original poster
Oct 21, 2007
267
0
No bother at all :) Sometimes having learnt desktop Cocoa first helps as this is basically the same as there.

And yes, I have a S2 Elise 111S :D

I understand. I essentially learned what I needed to of desktop Cocoa and then I dove into the iPhone; it was more due to time constraints. I'm a college student and the summer ran out.

Such a beautiful car! The Exige S in the states here is my dream car! I'm currently selling my car and could have picked up a Lotus Elise for cheap but it meant also buying a second car for the winter, so it's just not practical for me while I'm in school. I decided to get an 08 STI instead. But someday I will own a Lotus! I am very jealous :)!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.