Created
July 29, 2013 12:02
-
-
Save zapsleep/6103865 to your computer and use it in GitHub Desktop.
Setter for gyroscopeControl of DVParallaxView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)setGyroscopeControl:(BOOL)gyroscopeControl { | |
if (_gyroscopeControl == gyroscopeControl) | |
return; | |
_gyroscopeControl = gyroscopeControl; | |
if (gyroscopeControl) { | |
[self.motionManager startDeviceMotionUpdates]; | |
[self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; | |
} else { | |
[self.displayLink invalidate]; | |
[self.motionManager stopDeviceMotionUpdates]; | |
self.motionManager = nil; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment