Skip to content

Instantly share code, notes, and snippets.

Created February 23, 2016 01:22
Show Gist options
  • Save anonymous/f4a5357a34fb2651e4ac to your computer and use it in GitHub Desktop.
Save anonymous/f4a5357a34fb2651e4ac to your computer and use it in GitHub Desktop.
//
// JJWParallaxHeaderViewWithVisualEffect.m
// ParallaxScrollViewHeaderWithBlur
//
// Created by Joel West on 2/22/16.
// Copyright © 2016 WestSutdios. All rights reserved.
//
#import "JJWParallaxHeaderViewWithVisualEffect.h"
@implementation JJWParallaxHeaderViewWithVisualEffect
+ (instancetype)instantiateFromNibWithImage:(UIImage *)image withBlurEffectStyle:(UIBlurEffectStyle)blurEffectStyle {
NSArray *views = [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil];
JJWParallaxHeaderViewWithVisualEffect *headerView = views[0];
headerView.imageView.image = image;
if (blurEffectStyle) {
[headerView addBlurEffectWithStyle:blurEffectStyle];
}
return headerView;
}
- (void)addBlurEffectWithStyle:(UIBlurEffectStyle)style {
UIVisualEffect *blurEffect = [UIBlurEffect effectWithStyle:style];
self.visualEffectView.effect = blurEffect;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment