I need to anchor my vertical slider in the bottom left corner of my view.
This is my code:
let slider = UISlider()
var constraints = [NSLayoutConstraint]()
slider.transform = CGAffineTransform(rotationAngle: CGFloat(-(Double.pi/2)))
slider.translatesAutoresizingMaskIntoConstraints = false
constraints.append(slider.widthAnchor.constraint(equalTo: view.heightAnchor, multiplier: 0.3))
constraints.append(slider.centerYAnchor.constraint(equalTo: view.centerYAnchor))
NSLayoutConstraint.activate(constraints)
您需要添加一个前导/左约束
slider.leadingAnchor.constraint(equalTo: view.leadingAnchor)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.