开发者

Cocoa Touch - trigger a selection table view from a textfield

开发者 https://www.devze.com 2023-04-05 11:45 出处:网络
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

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

  1. When the gender textbox becomes first responder, in the textFieldShouldBeginEditing delegate, show up the gender pickerView in place of the original keyboard.
  2. Upon selecting of a gender, in the pickerView didSelectRow delegate, return the selected gender to the active textbox.

:)

0

精彩评论

暂无评论...
验证码 换一张
取 消