Skip to content

Instantly share code, notes, and snippets.

// Camera permission handling - iOS 8
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted){
if (granted)
{
dispatch_sync(dispatch_get_main_queue(), ^{
// Present camera controller here
});
}
else
{
@iGriever
iGriever / gist:6541396
Last active December 22, 2015 22:39
UIMotionEffect setup on multiple views
// Setup horizontal motion effect
UIInterpolatingMotionEffect *horizontalInterpolation = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
horizontalInterpolation.minimumRelativeValue = @-kMotionViewControllerInterpolationValue;
horizontalInterpolation.maximumRelativeValue = @kMotionViewControllerInterpolationValue;
// Setup vertical motion effect
UIInterpolatingMotionEffect *verticalInterpolation = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.y" type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];
verticalInterpolation.minimumRelativeValue = @-kMotionViewControllerInterpolationValue;
verticalInterpolation.maximumRelativeValue = @kMotionViewControllerInterpolationValue;