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

FXBlurView has a serious Bug, subview.hidden became false. #126

Open
iStarEternal opened this issue May 30, 2016 · 7 comments
Open

FXBlurView has a serious Bug, subview.hidden became false. #126

iStarEternal opened this issue May 30, 2016 · 7 comments

Comments

@iStarEternal
Copy link

iStarEternal commented May 30, 2016

FXBlurView has a serious Bug.
When I set subview hidden:
view.subviews[1].hidden = true;
And add FXBlurView:
[view addSubview:[[FXBlurView alloc] initWithFrame:view.bounds];
The subview.hidden will become false.

Example:

I'm using MJRefresh:
https://github.com/CoderMJLee/MJRefresh
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(refreshHeader:)];
header.lastUpdatedTimeLabel.hidden = true;
self.tableView.mj_header = header;

Now, all is all right! But when I add it:
FXBlurView *blurView = [[FXBlurView] alloc] initWithFrame:self.view.bounds];
[self.view addSubview:blurView];
And The I remove it.
[blurView removeFromSuperView];
self.tableView.mj_header.lastUpdatedTimeLabel.hidden was became false.

I find the was unusual when
for (CALayer *layer in superlayer.sublayers) { layer.hidden = false; }

There!

Please forgive me for being impolite, My English is not very good.

@iStarEternal
Copy link
Author

If you want to Demo, ask me.

@nicklockwood
Copy link
Owner

I think the problem is that FXBlurView hides subviews automatically when snapshotting, then re-shows them. I guess it should kee track of which ones were already hidden.

@iStarEternal
Copy link
Author

Thank you for your kind reply. I hope you can make it better soon.

@HoneyLuka
Copy link

I have same problem. I agree that this is a serious bug.

@HoneyLuka
Copy link

@nicklockwood I found this bug.

- (NSArray *)hideEmptyLayers:(CALayer *)layer
{
    NSMutableArray *layers = [NSMutableArray array];
    if (CGRectIsEmpty(layer.bounds)) // **** Bug is here. ****
    {
        layer.hidden = YES;
        [layers addObject:layer];
    }
    for (CALayer *sublayer in layer.sublayers)
    {
        [layers addObjectsFromArray:[self hideEmptyLayers:sublayer]];
    }
    return layers;
}

This line should check if the layer is already hidden:

if (CGRectIsEmpty(layer.bounds))

change to this will resolve problem:

if (CGRectIsEmpty(layer.bounds) && !layer.hidden)

@HoneyLuka
Copy link

Can I create a PR for this?

@kirian
Copy link

kirian commented Oct 27, 2016

@HoneyLuka sounds a good approach, they use all layers with bounds even the hidden layers in order to render the view. After rendering, they restore the superview unhiding all layers. (even your hidden layers).

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

4 participants