gpt4 book ai didi

ios - FXBlurView 背景滞后

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:46:23 28 4
gpt4 key购买 nike

我正在使用 FXBlurView因为我的 UIViews 背景模糊。我使用的是默认设置,这意味着它会更新每一帧。但是,由于某种原因,背景似乎有点滞后。这是我遇到的问题的 GIF:
BlurGIF http://www.interdazzle.com/misc/forums/BlurGIF.gif如果有人可以提供帮助,那就太好了。提前致谢!

编辑:我稍微更改了我的代码以符合 Nick 的建议,并得出以下结论:初始化时:

   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);

}];

当我为它制作动画时:

[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);
}];

但是,它似乎没有正确更新/定位。提前致谢!

最佳答案

扩展@NickLockwood 的问题:
当 FXBlurView 启动时,我运行这段代码:

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
}];

然后我简单地为对象设置动画,如下所示:

[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);
}];

谢谢!

关于ios - FXBlurView 背景滞后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23024074/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com