Skip to content

Instantly share code, notes, and snippets.

Last active October 21, 2015 06:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Drawing square at the center of the view
@IBOutlet var animationView: UIView!
var squareView:UIView!
override func viewDidLoad() {
func drawSquare(){
let squareSize = CGSize(width: 30.0, height: 30.0)
let centerPoint = CGPoint(x: self.animationView.bounds.midX - (squareSize.width/2), y: self.animationView.bounds.midY - (squareSize.height/2))
let frame = CGRect(origin: centerPoint, size: squareSize)
squareView = UIView(frame: frame)
squareView.backgroundColor = UIColor.orangeColor()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment