0

So I've put a UISlider into a view with the following code, but it could only be slided for the distance of about 10 points a time. It can only be dragged back and forth within a range of about 20 points. Why?

v = [[UIView alloc] initWithFrame:someFrame];
UISlider *slider = [[UISlider alloc] initWithFrame:CGRectMake(10, 10, 200, 30)];
[v addSubview:slider];
[self.view addSubview:v];

I've put this code into another test project, it does work. So it might be some other code. I'm wondering if anyone else has been through the same problem before.

1 Answer 1

1
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
    if([[touch view] isKindOfClass:[UISlider class]])
    {
        return NO;
    }
}

I was using IIViewDeckController, so I added this piece into the IIViewDeckController.m code and it solved the problem!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.