滑块拇指已锁定。除了以编程方式,我无法移动它。我不知道为什么。
- (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 只是一种调整拇指图像大小的方法。