Updated Answer for iOS 10
In iOS 10, you can use widgetPrimaryVibrancyEffect
and widgetSecondaryVibrancyEffect
to automatically return a UIVibrancyEffect
object.
Check out the documentation here and here.
Answer for iOS 9
Use this code to apply a vibrancy effect to your whole widget:
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:[UIVibrancyEffect notificationCenterVibrancyEffect]];
effectView.frame = self.view.bounds
effectView.autoresizingMask = self.view.autoresizingMask;
__strong UIView *oldView = self.view;
self.view = effectView;
[effectView.contentView addSubview:oldView];
self.view.tintColor = [UIColor clearColor];
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…