REFrostedViewController和iOS 8

时间:2014-12-07 23:38:21

标签: objective-c iphone ios8

我不确定是否有人对此进行了修复,但我一直在尝试使用此库我已经完成了所有设置,但似乎无法像演示中那样实现模糊。我有导航设置和正常工作,但我无法设置模糊或模糊色调。我可以自定义方向和其他几个属性,但模糊似乎不起作用。我唯一能想到的是这对iOS 8不起作用。这是我的RootViewController的awakeFromNib

- (void)awakeFromNib {
    self.contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"homeController"];
    self.menuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"sideMenuController"];
    self.liveBlur = NO;
    self.liveBlurBackgroundStyle = REFrostedViewControllerLiveBackgroundStyleLight;
    self.blurRadius = 60;
    self.blurTintColor = [UIColor colorWithRed:45/255.0 green:55/255.0 blue:56/255.0 alpha:0.6];
 }

1 个答案:

答案 0 :(得分:1)

如果您只需要iOS8模糊,则可以使用此代码。在那里,您将创建具有模糊效果的VisualEffectView,然后将框架设置为此视图。

    UIVisualEffect *effect;
    effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
//    effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
//    effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];

    UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:effect];
    blurEffectView.frame = self.view.frame;
    [self.view addSubview:self.blurEffectView];

但是你也可以使用UIImage + ImageEffects apple库。

<强>更新

这是一个结果:在视图控制器上模糊并在顶部影响UILabel。

enter image description here

相关问题