xcode - How to add more blocks -


i tried adding var square, , things did squareview. getting 1 box falling , other standing there. there easier way add box same action squareview?

import uikit  class interestviewcontroller: uiviewcontroller {     var squareview: uiview!     var square: uiview!     var gravity: uigravitybehavior!     var animator: uidynamicanimator!     var collision: uicollisionbehavior!     override func viewdidload() {         super.viewdidload()         squareview = uiview(frame: cgrectmake(100, 100, 100, 100))         square = uiview(frame: cgrectmake(200, 100, 100, 100))          squareview.backgroundcolor = uicolor.blackcolor()         square.backgroundcolor = uicolor.blackcolor()         view.addsubview(square)         view.addsubview(squareview)         animator = uidynamicanimator(referenceview: view)         animator = uidynamicanimator(referenceview: view)         gravity = uigravitybehavior(items: [squareview])         gravity = uigravitybehavior(items: [square])         animator.addbehavior(gravity)         animator.addbehavior(gravity)         collision = uicollisionbehavior(items: [squareview])         collision = uicollisionbehavior(items: [square])         collision.translatesreferenceboundsintoboundary = true         animator.addbehavior(collision)         // additional setup after loading view.     }      override func didreceivememorywarning() {         super.didreceivememorywarning()         // dispose of resources can recreated.     }  } 

this code sheer nonsense:

gravity = uigravitybehavior(items: [squareview]) gravity = uigravitybehavior(items: [square]) animator.addbehavior(gravity) animator.addbehavior(gravity) 

when set variable gravity 1 behavior , behavior right in row, first behavior thrown out if never existed. naturally when around adding behaviors, there 1 behavior add: 1 gravity left (which then, more nonsensically, add twice). naturally 1 block animated.

think of more way:

var x = 0 x = 1 x = 2 

now, value of variable x? if think 0 and 1 and 2, have not understood variable is.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -