UISlider only slide a small distance

喜夏-厌秋 提交于 2020-01-06 08:09:49

问题


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:


- (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!



来源:https://stackoverflow.com/questions/11104549/uislider-only-slide-a-small-distance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!