为什么这不起作用:
[self.phoneTextField.rac_textSignal subscribeNext:^(NSString *text) {
self.viewModel.textFieldText = text;
}];
虽然效果很好,但即使点击了清除按钮:
RAC(self.viewModel, textFieldText) = RACObserve(self.phoneTextField, text);
答案 0 :(得分:1)
rac_textSignal仅在UIControlEventAllEditingEvents触发时触发,并且不会发生清除。以下是两种情况的解决方法:
[[RACSignal
merge:@[self. phoneTextField.rac_textSignal, RACObserve(self.phoneTextField, text)]]
subscribeNext:^(NSString* text) {
// do something here
}];
BR,