// make the font bigger dotButton.titleLabel.font = UIFont.systemFontOfSize(32) // add rounded corners dotButton.backgroundColor = UIColor(white: 0.9, alpha: 1) dotButton.layer.cornerRadius = 5 view.addSubview(dotButton) // makes the vertical centers equa; var dotCenterYConstraint = NSLayoutConstraint(item: dotButton, attribute: .CenterY, relatedBy: .Equal, toItem: view, attribute: .CenterY, multiplier: 1.0, constant: 0) // set the button 50 points to the left (-) of the horizontal center var dotCenterXConstraint = NSLayoutConstraint(item: dotButton, attribute: .CenterX, relatedBy: .Equal, toItem: view, attribute: .CenterX, multiplier: 1.0, constant: -50) view.addConstraints([dotCenterXConstraint, dotCenterYConstraint]) }
接下来对于dash,和,这个过程都比较类似 。这个会从proxy使用方法,然后会通过er使用方法 。
划
与dash相关的代码几乎和代码一致 。为了将按钮在水平方向与 点 按钮对称,只要将水平约束中的常量改变一下符号即可 。
- func addDash() {