简体   繁体   中英

Objective C - Making UILabel update as user types text in UITextField

How would I make a UILabel update as a user enters text in a UITextField. In my case, I have a quadratic equation solver for the iPhone and as the user enters the values of ab & c, I want a UILabel to update with the numbers given by the user.

[textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];

然后,您的textFieldDidChange方法就像这样:

self.quadLabel.text = self.quadInput.text;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM