Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FXBlurView Background Lagging

Tags:

ios

uiview

blur

I'm using FXBlurView for my background blurs on my UIViews. I'm using the default settings, which means that it updates every frame. However, for some reason, the background seems to lag a bit. Here is a GIF of the issue I'm having:
BlurGIF http://www.interdazzle.com/misc/forums/BlurGIF.gif If anyone could help, that would be wonderful. Thanks in advance!

Edit: I changed my code a bit to match what Nick suggested, and came up with this: When it is initialized:

   self.sidebar.blurRadius = 30;
    self.sidebar.dynamic = NO;
    self.sidebar.contentMode = UIViewContentModeLeft;
    [self.sidebar updateAsynchronously:YES completion:^{
        self.sidebar.frame = CGRectMake(0, 0, 250, [[UIScreen mainScreen] bounds].size.height);

    }];

When I animate it:

[UIView animateWithDuration:0.5 animations:^{
    BOOL open = self.sidebar.frame.size.width >= 250;
    self.sidebar.frame = CGRectMake(open? -250: 0, self.sidebar.frame.origin.y, open? 0: 250, self.sidebar.frame.size.height);
}];

However, it doesn't seem to update/position correctly. Thank you in advance!

like image 645
Zoyt Avatar asked Feb 06 '26 14:02

Zoyt


1 Answers

Expanding on @NickLockwood's question:
When the FXBlurView is initiated, I run this code:

self.sidebar.blurRadius = 30;
self.sidebar.dynamic = NO;
self.sidebar.contentMode = UIViewContentModeRight;
self.sidebar.layer.contentsGravity = kCAGravityBottomLeft;
[self.sidebar setClipsToBounds:YES];
[self.sidebar updateAsynchronously:YES completion:^{
    // Whatever you want
}];

Then I simply animate the object like this:

[UIView animateWithDuration:0.5 animations:^{
        BOOL open = self.sidebar.frame.size.width > 125; // Over half way done
        self.sidebar.frame = CGRectMake(0,0, open? 0 : 250, [[UIScreen mainScreen] bounds].size.height);
    }];

Thanks!

like image 185
Zoyt Avatar answered Feb 09 '26 08:02

Zoyt