Reputation: 71
I added a custom slider to my scrollview on my viewcontroller but after adding it I am unable to scroll. I have looked at similar questions on here but
scrollview.canCancelContentTouches=NO;
is not working. Any suggestions? Thanks.
Slider code:
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];
Upvotes: 0
Views: 644
Reputation: 8247
You need to detect when you use the slider and stop use the scrollview.
I think this answer can help
Upvotes: 1