How to delete the contents of a UITextField programmatically?

前端 未结 2 841
[愿得一人]
[愿得一人] 2021-01-27 08:14

I am writing an iPhone app that has a number of UITextFields that requires the user to input a bunch of data. I would like to have a simple \'delete\' facility that allows the u

2条回答
  •  粉色の甜心
    2021-01-27 08:29

    You can just assign tags to each textfield in a sequence using tag property in interface builder and then get the textField like this

    UITextField *txtf = (UITextField*)[self.view viewWithTag:aTagValue];
    
    txtf.text = @""; or nil;
    

提交回复
热议问题