Cocoa Touch - trigger a selection table view from a textfield
Hihi all,
I have a TextField (the TextField is added into the TableViewCell from code) in my first view for gender selection. Would need to trigger a second view for gender selection upon clicking on the TextField. After selected a gender from the second view, the second view should be dismissed and the selected gender value should be returned back to the active TextField in the first view.
Hope that I am clear enough on my question. This might be just a foolish question, but I am still new in cocoa touch. Thanks i开发者_StackOverflown advance!
:)
If you are trying to get a selection of gender, then why is it a textbox? You could convert the selection itself directly into a text in code. Why display a text box? Could you elaborate on what is it that you want to do. It is not so clear by your description.
Instead of create a second view for the gender selection, this is what I have implemented
- When the gender textbox becomes first responder, in the textFieldShouldBeginEditing delegate, show up the gender pickerView in place of the original keyboard.
- Upon selecting of a gender, in the pickerView didSelectRow delegate, return the selected gender to the active textbox.
:)
精彩评论