ios - Why not change my background and title after accelerometer data is recieved? SWIFT -
print , func call successful both time, background , title change when restart app , works 1 times. here code: var motionmanager = cmmotionmanager() override func viewdidappear(animated: bool) { super.viewdidappear(animated) startmotionmanager() } func startmotionmanager() { if motionmanager.accelerometeravailable { motionmanager.accelerometerupdateinterval = 0.2 motionmanager.startaccelerometerupdatestoqueue(nsoperationqueue(), withhandler: { [weak self] (data, error) in print(data!.acceleration.z) if(data!.acceleration.z > 0.8) { self!.win() print("win") } if (data!.acceleration.z < -0.9){ self!.pass() print("pass") } return }) } } func pass() { print("passfunction") self.testlabel.text = "pass" self.view.backgroundcolor = uicolor.redcolor() } func win() { testlabel.text...