detecting the change of content of UITextField when the change is not made by the keyboard

前端 未结 7 1555
挽巷
挽巷 2020-12-30 04:54

I have a UIButton and a UITextField,when the button is pressed the textfield\'s content string will be equal to: This is a test string

相关标签:
7条回答
  • 2020-12-30 05:54

    This is a pretty robust solution, but it should work. In your function that is called when you press the button...

    NSString *string = [NSString stringWithFormat:@"This is a test string"];
    if(string == textfield.text){
    ...
    }
    

    Or, you can us a self scheduler to check if it has changed repeatedly.

    0 讨论(0)
提交回复
热议问题