我不确定为什么这不起作用:
- (IBAction)sliderValueChanged:(UISlider *)sender {
if (_menuRightItem2.selected == YES) {
NSLog(@"yes");
if (sender == self.slider1)
[sender setValue:((int)((slider1.value + 1) / 1.0) - 1.0) animated:NO];
else if (sender == self.slider2)
[sender setValue:((int)((slider2.value + 1) / 1.0) - 1.0) animated:NO];
}
barHeight = slider1.value * -20 + slider2.value * -50; //! hoogte in de min, yea right.
[UIView animateWithDuration:0.50 animations:^{
self.orangeView.frame = CGRectMake(595, 615, 80, barHeight);
}];
}
我要完成的工作是,当menuRightItem2
被选中时,它将执行我的if else
声明,否则不会。但我NSLog()
的甚至没有工作。实现这一目标的正确方法是什么?
我的按钮声明:
- (IBAction)menuRightItem2Touch:(id)sender {
_menuRightItem2.selected = !_menuRightItem2.selected;
}