app的注册界面,一般都要求注册信息都要填写完全注册按钮才能点击,使用RAC一段代码实现这样的效果
RAC(self, registerBtn.enabled) = [RACSignal combineLatest:@[RACObserve(self, myRegister.userName),
RACObserve(self, myRegister.phoneCode),
RACObserve(self, myRegister.password),
RACObserve(self, myRegister.captcha),
reduce:^id(NSString *userName,
NSString *phoneCode,
NSString *password,
NSString *captcha, {
BOOL enabled = (userName> 0 &&
password.length > 0 &&
captcha.length > 0)
return @(enabled);
}];