Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @implementation MMTouchSlider
- -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
- UITouch *touch = [[event allTouches] anyObject];
- CGPoint touchLocation = [touch locationInView:self];
- self.value = self.minimumValue + (self.maximumValue - self.minimumValue) * (touchLocation.x / self.frame.size.width);
- [super touchesBegan:touches withEvent:event];
- }
- - (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value {
- CGRect thumbRect = [super thumbRectForBounds:bounds trackRect:rect value:value];
- return thumbRect;
- }
- @end
- UISlider *slider = [[UISlider alloc] initWithFrame:CGRectMake(100, 100, 200, 10)];
- float angleInDegrees = 270;
- float angleInRadians = angleInDegrees * (M_PI/180);
- slider.transform = CGAffineTransformMakeRotation(angleInRadians);
- [self.view addSubView:slider];
Add Comment
Please, Sign In to add comment