문제

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