How to achieve this custom Scroll bar in IOS or something similar to it?

1.5k Views Asked by At

Actually I have a table view with options, but alongside I have a complicated scroll design. How could I go about implementing this scroller?

enter image description here

2

There are 2 best solutions below

1
On BEST ANSWER

Create UISlider vertical

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self addSliderVertical];
}

-(void) addSliderVertical{
    slider=[[UISlider alloc]initWithFrame:CGRectMake(20, 40, 300, 300)];// set fram your require position 
    CGAffineTransform trans=CGAffineTransformMakeRotation(M_PI_2);
    slider.transform=trans;
    [self.view addSubview:slider];
    slider.minimumValue=1;
    slider.maximumValue=100;
    slider.continuous=NO;
    [slider addTarget:self action:@selector(sliderChanhge:) forControlEvents:UIControlEventValueChanged];
}

Slider change method

-(IBAction)sliderChanhge:(id)sender
{
    // here change tableview scroll offset
    [self.tableView setContentOffset:CGPointMake(0, (int)slider.value) animated: YES];
}
0
On

You could probably use a customized UISlider for this. When the value of the slider changes, you can adjust the scroll offset of the UITableView next to it.

I wonder whether it is really necessary for your design to use this kind of element since it is not very intuitive (at least on iOS) to use a custom scrollbar. When you really have to use the custom scrollbar, I would go with a customized version of an UISlider.