所以我的导航栏中有一个 UIBarButtonItem 并想像这样使用 RAC():
RAC(myButton, enabled) = [RACSignal
combineLatest:@[ RACObserve(self, password), RACObserve(self, passwordConfirmation) ]
reduce:^(NSString *password, NSString *passwordConfirm) {
return @([passwordConfirm isEqualToString:password]);
}];
还有 rac_command点击时捕获,如下所示:
myButton.rac_command = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) {
// Do stuff
return [RACSignal empty];
}];
当我将这两者结合起来时,我收到断言错误。
所以问题是:如何组合使用 RAC() 和 rac_command?
最佳答案
改用-[RACCommand initWithEnabled:signalBlock:]
。
关于reactive-cocoa - RAC() 和 .rac_command 不能一起工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22347423/