How can I read UITextField value in an IBAction. I'm creating UITextField programmatically

后端 未结 4 827
醉话见心
醉话见心 2021-01-15 06:30

How can I read UITextField value in an IBAction? I\'m creating UITextField programmatically. So I can\'t set @property an

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-15 06:50

    implement the IBAction function like the following:

    -(IBAction) doneEditing:(UITextField*)sender
    {
        NSString * val = sender.text;
    
    }
    

    try using the UITextFieldDelegate , i think its better for your case.

    add each UITextField a Tag and by that you will recognise the UITextField.

提交回复
热议问题