I am using PureLayout
to put a UISlider
between 2 buttons as below:
[self.slider autoPinEdge:ALEdgeLeading toEdge:ALEdgeTrailing ofView:self.leftButton withOffset:10.0f]; [self.slider autoPinEdge:ALEdgeTrailing toEdge:ALEdgeLeading ofView:self.rightButton withOffset:10.0f]; [self.slider autoAlignAxisToSuperviewAxis:ALAxisHorizontal];
Is it possible that the UISlider
automatically sets its width between the leftButton
and the rightButton
?
To autolayout the width of UISlider you should provide the width of left and right button. Also, you have to pin them to the superview edges. Then you're able to pin LEFT edge of slider to RIGHT edge of leftButton, and RIGHT edge of slider to LEFT edge of rightButton.
Example code :