滑块拇指已锁定。我不能以编程方式移动它。我无法弄清楚原因。
- (void)revealOrHideSlideBar:(UILongPressGestureRecognizer*) sender
{
for (UIView* subview in [self.view subviews])
if ([subview isMemberOfClass:[UIImageView class]])
[[subview subviews] makeObjectsPerformSelector: @selector(removeFromSuperview)];
UIImageView* imageview = (UIImageView*) [sender view];
UISlider* slider = [[UISlider alloc] initWithFrame:CGRectMake(0, imageview.bounds.size.height, imageview.bounds.size.width, 10)];
slider.minimumValue = -5;
slider.maximumValue = 5;
[slider setThumbImage:[Utils imageWithImage:[UIImage imageNamed:@"sliderThumb"] scaledToSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
// todo: set slider value from imageView properties
[imageview addSubview:slider];
}
imageWithImage只是一个调整拇指图像大小的方法。