It seems like I need to use
@interface ViewController : UIViewController <UITextFieldDelegate>
and
- (void)textViewDidChange:(UITextView *)textView {
label.text = textField.text;
}
and maybe something like this in viewDidLoad
- (void)viewDidLoad
{
[super viewDidLoad];
[textField addTarget:self action:@selector(textViewDidChange) forControlEvents:UIControlEventEditingChanged];
}
It crashes on entering text if I do it like this… Otherwise it just updates when its completed.
Replace
with
since your method takes a parameter: the text field itself. This argument is part of the selector and represented by the colon.
Or just implement the UITextView delegate methods: there’s a value-changed-callback, too.