更改通知内容扩展程序背景颜色

时间:2016-07-25 12:33:52

标签: ios notifications xcode8 ios10

在开发Notification Content Extension时,我注意到,无法更改背景颜色以清除颜色。

我希望它看起来像天气标准应用小部件的背景。

enter image description here

因此,如果我将视图的背景颜色更改为IB或按代码清除,则它会变为白色而没有alpha。

enter image description here 你看到背景模糊和白色通知背景的按钮看起来很糟糕。如果您有一些想法,请告诉我。 在iPhone 6 Plus和iPhone 6s iOS 10 beta 3和Xcode 8 beta 3上测试。

1 个答案:

答案 0 :(得分:0)

你可以尝试像这样添加self.view.backgroundColor = [UIColor clearColor]; UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]; UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; blurEffectView.frame = self.view.bounds; blurEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; blurEffectView.alpha = 0.5; [self.view insertSubview:blurEffectView atIndex:0];

UIBlurEffectStyle

您可以使用背景颜色或使用.sass来实现您喜欢的确切内容。

相关问题