I added a progress bar to my screen and have currently placed it at the center of my screen. Instead, I want it to be centered horizontally in my container, but at the bottom of the screen. (If I was writing with CGPoint, I would make it say y: self.frame.midY-250). How do I edit the third line to make it center x, but change its y-position?
func addControls() {
progressView = UIProgressView(progressViewStyle:
UIProgressViewStyle.Default)
progressView?.center = self.view.center
view.addSubview(progressView!)
}
You have most of the answer in your own question.
let pos = CGPoint(x: self.view.bounds.midX, y: self.view.bounds.maxY - 250)
progressView?.center = pos
Change the 250
to be however far from the bottom you want the progress view.
But it would be better to use constraints to setup the size and position of the progress view. That would ensure the progress view stays in the proper place if the device is rotated and its superview size changes.