Vertical UISlider in iOS with autolayout

后端 未结 10 1898
难免孤独
难免孤独 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:50

    In your viewDidLoad, try:

    UIView *superView = self.sizeSlider.superview;
    [self.sizeSlider removeFromSuperview];
    [self.sizeSlider removeConstraints:self.view.constraints];
    self.sizeSlider.translatesAutoresizingMaskIntoConstraints = YES;
    self.sizeSlider.transform = CGAffineTransformMakeRotation(M_PI_2);
    [superView addSubview:self.sizeSlider];
    

    It does not work with constraints, so the trick is to remove the constraints for your uislider. You might have to resize it manually by setting its frame property.

提交回复
热议问题