Vertical UISlider in iOS with autolayout

后端 未结 10 1901
难免孤独
难免孤独 2021-02-07 07:22

As per my iPad app requirement, i\'ve to show the UISlider vertically.
I\'m using iOS7 compiler and deployment target is iOS6.
In the story board I added horizontal UISl

10条回答
  •  逝去的感伤
    2021-02-07 07:44

    I got it to work this way:

    In viewDidLoad: I added

    [self.slider removeConstraints:self.slider.constraints];
    [self.slider setTranslatesAutoresizingMaskIntoConstraints:YES];
    

    so that it's called before rotating the slider with

    self.slider.transform=CGAffineTransformRotate(self.slider.transform,270.0/180*M_PI);
    

    and there is no need to remove and re-add it to superview.

提交回复
热议问题