Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
override func viewDidLoad() {
// Do any additional setup after loading the view, typically from a nib.
var redView = UIView()
redView.backgroundColor = UIColor.redColor()
var greenView = UIView()
greenView.backgroundColor = UIColor.greenColor()
var blueView = UIView()
blueView.backgroundColor = UIColor.blueColor()
var spacerView1 = UIView()
spacerView1.backgroundColor = UIColor(white: 7.0/8.0, alpha: 1.0)
var spacerView2 = UIView()
spacerView2.backgroundColor = UIColor(white: 7.0/8.0, alpha: 1.0)
for aView in [redView, greenView, blueView, spacerView1, spacerView2] {
for aView in [view, redView, greenView, blueView, spacerView1, spacerView2] {
let viewsDictionary = [
let metricsDictionary = ["margin":20, "viewWidth":80]
options: NSLayoutFormatOptions(0),
metrics: nil,
views: viewsDictionary))
options: .AlignAllTop,
metrics: metricsDictionary,
views: viewsDictionary))
for view in [redView, spacerView1, greenView, spacerView2, blueView] {
item: view,
attribute: .Height,
relatedBy: .Equal,
toItem: nil,
attribute: .Height,
multiplier: 0.0,
constant: 80))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.