在RGB颜色这节课中出现了crash
- (void)viewDidLoad { [super viewDidLoad]; self.redField.text = self.greenField.text = self.blueField.text = @"0.5"; RACSignal *redSignal = [self bindSlider:self.redSlider textField:self.redField]; RACSignal *greenSignal = [self bindSlider:self.greenSlider textField:self.greenField]; RACSignal *blueSignal = [self bindSlider:self.blueSilder textField:self.blueField]; // RACSignal *resultSignal = [[RACSignal combineLatest:@[redSignal, greenSignal, blueSignal]] map:^id _Nullable(RACTuple * _Nullable value) { // return [UIColor colorWithRed:[value[0] floatValue] green:[value[1] floatValue] blue:[value[2] floatValue] alpha:1]; // }]; // // RAC(self.RGBView, backgroundColor) = resultSignal; } -(RACSignal *)bindSlider:(UISlider *)slider textField:(UITextField *)textField { RACChannelTerminal *sliderChannel = [slider rac_newValueChannelWithNilValue:nil]; RACChannelTerminal *fieldChannel = [textField rac_newTextChannel]; [sliderChannel subscribe:fieldChannel]; [sliderChannel map:^id _Nullable(id _Nullable value) { return [NSString stringWithFormat:@"%.02f", [value floatValue]]; }]; return [sliderChannel merge:fieldChannel]; }
希望老师给看看谢谢!