我是 Reactive Cocoa 的新手。
在将文本视图文本替换为修剪后的版本后,我需要在将空白添加到 a 时触发内容UITextView
。所以基本上我正在寻找某种完成事件。我想这是一件简单的事情,但我一定错过了一些重要的东西......这就是我所拥有的:
RACSignal *whitespaceSignal = [self.field.rac_textSignal filter:^BOOL(NSString *input) {
return [self textContainsWhitespace:input];
}];
RAC(self.field, text) = [whitespaceSignal map:^id(NSString *input) {
// The stuff that needs to happen *after* the text field has
// got the new, trimmed value.. But here it gets triggered before
// the UITextView updates its value.
// [self respondToWhiteSpaceTrimmedEvent];
return [self trimWhitespace:input];
}];
我尝试了几种subscribeCompleted
, then
,completed
块的组合,但没有一个被调用。
如何检测何时self.field.text
响应 更新其值whitespaceSignal
,然后才触发我的副作用?