Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/106.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios ReactiveCocoa`rac_textSignal`映射已完成事件_Ios_Objective C_Uitextview_Reactive Cocoa_Racsignal - Fatal编程技术网

Ios ReactiveCocoa`rac_textSignal`映射已完成事件

Ios ReactiveCocoa`rac_textSignal`映射已完成事件,ios,objective-c,uitextview,reactive-cocoa,racsignal,Ios,Objective C,Uitextview,Reactive Cocoa,Racsignal,我是新来的 在将文本视图文本替换为修剪过的版本后,如果将空白添加到UITextView,我需要触发填充。所以基本上我在寻找某种形式的完成事件。我想这是一件直截了当的事情,但我肯定错过了一些重要的东西。。。这就是我所拥有的: RACSignal *whitespaceSignal = [self.field.rac_textSignal filter:^BOOL(NSString *input) { return [self textContainsWhitespace:input]; }

我是新来的

在将文本视图文本替换为修剪过的版本后,如果将空白添加到
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];
}];
我尝试了几种组合的
subscribebecompleted
then
completed
块,但都没有被调用


如何检测
self.field.text
何时更新其值以响应
空白信号,然后才触发我的副作用?

您是否订阅过创建的信号?你过滤/映射信号,但很明显你没有订阅信号,所以我想这就是原因

[[self.field.rac_textSignal 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];
}] subscribeNext:^(id x) {
    // Do some stuff after you replace whitespace ...
}];

您是否在映射之后尝试了
doNext
?您应该在doNext中收到更新的“修剪”值,并且可以在doNext中响应修剪的事件值block@Nimble谢谢,不幸的是,这也没有被调用。更正,
doNext
确实被调用,但是如果
UITextView
的文本到那时还没有更新(而且没有更新),对我来说是没有用的.
doComplete
未被调用。请解释您到底想要实现什么,也许可以使用不同的功能来实现