我在我的viewcontroller上添加了一个自定义滑块到我的滚动视图但添加后我无法滚动。我在这里看了类似的问题,但是
scrollview.canCancelContentTouches=NO;
无效。有什么建议?谢谢。
滑块代码:
CGRect frame = CGRectMake(20, 12.0, 280.0, 480);
_customSlider = [[UISlider alloc] initWithFrame:frame];
[_customSlider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged];
_customSlider.backgroundColor = [UIColor clearColor];
UIImage *stetchLeftTrack = [[UIImage imageNamed:@"orangeslide.png"]
stretchableImageWithLeftCapWidth:2.0 topCapHeight:0.0];
UIImage *stetchRightTrack = [[UIImage imageNamed:@"slider.png"]
stretchableImageWithLeftCapWidth:2.0 topCapHeight:0.0];
[_customSlider setMinimumTrackImage:stetchLeftTrack forState:UIControlStateNormal];
[_customSlider setMaximumTrackImage:stetchRightTrack forState:UIControlStateNormal];
_customSlider.minimumValue = 0.0;
_customSlider.maximumValue = 10.0;
_customSlider.continuous = YES;
_customSlider.value = 50.0;
[ _scrollview addSubview:_customSlider];