Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

there is a bug with parallaxHeaderViewWithSubView: #6

Closed
heyehao2008 opened this issue Jan 14, 2015 · 2 comments
Closed

there is a bug with parallaxHeaderViewWithSubView: #6

heyehao2008 opened this issue Jan 14, 2015 · 2 comments

Comments

@heyehao2008
Copy link

hi, thanks for your code
i attempt to use this method to creat a headerView. my subView has a button for login. when i clicked login button to push to loginViewController and back to root, the bluredImageView is malposition.

finally,i fix this bug by following code:

  • (void)refreshBlurViewForNewImage
    {
    UIImage *screenShot;
    if (self.subView) {
    screenShot = [self getImageFromView:self.subView];
    }else{
    screenShot = [self getImageFromView:self];
    }
    screenShot = [screenShot applyBlurWithRadius:5 tintColor:[UIColor colorWithWhite:0.6 alpha:0.2] saturationDeltaFactor:1.0 maskImage:nil];
    self.bluredImageView.image = screenShot;
    self.bluredImageView.alpha = 0.0f;
    }

and , i find the screenShot method in the code always flicker when it is called, so i instead of method :
-(UIImage *)getImageFromView:(UIView *)orgView{
UIGraphicsBeginImageContext(orgView.bounds.size);
[orgView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
Forgive my rude,may it's my own mistack, thancks a lot.

@Vinodh-G
Copy link
Owner

Hi Ronda,
Thanks for the feedback, I will look into the malpositioning issue.

I have few thing regarding the glitch, use afterScreenUpdates to NO instead of YES as shown below
[self drawViewHierarchyInRect:kDefaultHeaderFrame afterScreenUpdates:NO]

[view.layer renderInContext:UIGraphicsGetCurrentContext()] is CALayer level rendering the view image.
Apple as introduced drawViewHierarchyInRect: for UIView class from iOS 7 onwards, for view rendering and it tell thats it is much more faster than renderInContext: of Layer class, so the glitch may fix with telling NO to [view drawViewHierarchyInRect:rect afterScreenUpdates:NO] instead of using renderInContext

Thanks,
Vinodh

@heyehao2008
Copy link
Author

Thanks for you guide. I got it !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants