为什么这不起作用:
[self.phoneTextField.rac_textSignal subscribeNext:^(NSString *text) {
self.viewModel.textFieldText = text;
}];
虽然这很好用,即使点击清除按钮也是如此:
RAC(self.viewModel, textFieldText) = RACObserve(self.phoneTextField, text);
?
最佳答案
rac_textSignal 仅在 UIControlEventAllEditingEvents 触发时才会触发,并且清除时不会发生这种情况。这是两种情况的解决方法:
[[RACSignal
merge:@[self. phoneTextField.rac_textSignal, RACObserve(self.phoneTextField, text)]]
subscribeNext:^(NSString* text) {
// do something here
}];
BR,
关于ios - ReactiveCocoa : why rac_textSignal doesn't work,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44656178/