1. 程式人生 > >iOS磨砂(半透明)效果實現

iOS磨砂(半透明)效果實現

// 判斷系統版本是否支援 8.0 UIView *blurEffectView; if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) { // 磨砂效果 UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]; // 磨砂檢視 blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; } else
{ // 螢幕截圖 - 呼叫蘋果官方框架實現磨砂效果 UIImage *screenShot = [UIImage screenShot].applyLightEffect; blurEffectView = [[UIImageView alloc] initWithImage:screenShot]; } // [self addSubview:blurEffectView]; [self insertSubview:blurEffectView atIndex:0]; [blurEffectView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges
.equalTo(self); }];