Skip to content

Instantly share code, notes, and snippets.

@zapsleep
Created July 29, 2013 12:02
Show Gist options
  • Save zapsleep/6103865 to your computer and use it in GitHub Desktop.
Save zapsleep/6103865 to your computer and use it in GitHub Desktop.
Setter for gyroscopeControl of DVParallaxView
-(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