UISlider does not redraw automatically

前端 未结 2 594
暗喜
暗喜 2021-01-28 16:49

I\'ve an UISlider on my app and I need sometimes to update not only its value but also its minimumValue. The values are changed but if I call the setValue method or assign a new

2条回答
  •  感动是毒
    2021-01-28 17:03

    I've solved that by removing and adding again the slider to the toolbar. I've used this code:

    NSMutableArray *items = [NSMutableArray arrayWithArray:self.toolbar.items];
    id slider = [items lastObject]; 
    [items removeLastObject];
    self.toolbar.items = items;    
    [items addObject:slider];
    self.toolbar.items = items;
    

    I've recovered my slider using an id instead an UISlider because that slider is inside a UIBarButtonItem

提交回复
热议问题