I'm working on the air application and there I have a progress view. How it looks now
So, I need to know, how it possible to add image to progress view and it will move together. Here is how it should look like: result
I've tried something like this: progressView.trackImage = UIImage(named: "smallPlane")
Update:
*
func setupProgressView() {
middleView.insertSubview(planeView, aboveSubview: progressView)
let leadingConstraint = planeView.leadingAnchor.constraint(equalTo: progressView.leadingAnchor)
NSLayoutConstraint.activate(
leadingConstraint,
planeView.widthAnchor(equalToConstant: ),
planeView.heightAnchor(equalToConstant: ),
planeView.centerYAnchor(equalTo: progressView.centerYAnchor)
)
leadingConstraint.isActive = true
leadingConstraint.constant = progressView.frame.width * CGFloat(progressView.progress)
progressView.transform = progressView.transform.scaledBy(x: 1, y: 0.5)
}
You need to create an
UIImageViewand change it’s position according to the progress. Let's say you havesomeView, which contains your progress view:Now you can change the
constantof theleadingConstraintwhen you change theprogressofprogressViewlike that: