Commit db9aa7a7 authored by toby's avatar toby

move view setup to loadView

parent 60a7945f
......@@ -119,8 +119,9 @@ class RootViewController: UIViewController {
navigationController!.setNavigationBarHidden(true, animated: false)
}
override func viewDidLoad() {
super.viewDidLoad()
override func loadView() {
let windowRect = UIScreen.mainScreen().bounds
let view = UIView.init(frame: windowRect)
autoViews["main"] = view
......@@ -150,7 +151,11 @@ class RootViewController: UIViewController {
let hAuthButtonConstraint = NSLayoutConstraint.constraintsWithVisualFormat("H:[flipButton(50)]-0-|", options: .AlignAllTop, metrics: nil, views: autoViews)
view.addConstraints(vAuthButtonConstraint)
view.addConstraints(hAuthButtonConstraint)
self.view = view
}
override func viewDidLoad() {
super.viewDidLoad()
// Setup gravity
gravity = UIGravityBehavior()
......@@ -160,7 +165,9 @@ class RootViewController: UIViewController {
// Setup collisions
collision = UICollisionBehavior()
collision.translatesReferenceBoundsIntoBoundary = true
collision.addBoundaryWithIdentifier("barrier", forPath: UIBezierPath(rect: barrier.frame))
barriers.map() {
self.collision.addBoundaryWithIdentifier("barrier", forPath: UIBezierPath(rect: $0.frame))
}
// Setup animator
animator = UIDynamicAnimator(referenceView: view)
......@@ -173,7 +180,6 @@ class RootViewController: UIViewController {
tap = UITapGestureRecognizer(target: self, action: Selector("newBlock:"))
view.addGestureRecognizer(tap)
// Setup state machine
machine = StateMachine(initialState: .Ready, delegate: self)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment