Right now I have a UISlider that I set to hidden when a button is hit, but if I I'm interacting with the UISlider while I hit the button, the slider disappears but I'm still able to move the values of the slider.

I've tried to setUserIneractionEnabled = NO on the button press but that doesn't seem to do the trick.

Any idea on how I should go about disabling this?

EDIT * My code *

- (void)didPressButton:(UIButton *)button
{
   if (!self.isShowingDetailView) //
   {
       self.showingDetailView = YES;
       self.valueSlider.hidden = YES;
       self.valueSlider.userInteractionEnabled = NO;
   }
   else
   {
       self.showingDetailView = NO;
       self.valueSlider.hidden = NO;
       self.valueSlider.userInteractionEnabled = YES;
   }

}
有帮助吗?

解决方案

One way to fix is to set the exclusiveTouch property on the button and the slider. This way they can not receive touch simultaneously.

It can be set either in Interface Builder or in code

其他提示

If the value of the slider is important to you when the button is tapped then you should get and store the value when the button is tapped. Equally, you should set the slider value just before it is shown again.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top