FXBlurView是UIView的子類,它實現(xiàn)毛玻璃效果的原理其實就是覆蓋上一層FXBlurView的實例對象。
- (void)viewDidLoad {
[super viewDidLoad];
UIImageView * imageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
imageView.image = [UIImage imageNamed:@"Default-Port-hd47"];
[self.view addSubview:imageView];
FXBlurView * aview = [[FXBlurView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
aview.tintColor = [UIColor whiteColor];? //前景顏色
aview.blurRadius = 20.0;???????????????? //模糊半徑
aview.dynamic = YES;???????????????????? //動態(tài)改變模糊效果
[self.view addSubview:aview];
FXBlurView * bview = [[FXBlurView alloc] initWithFrame:CGRectMake(0, 120, 100, 100)];
bview.tintColor = [UIColor whiteColor];? //前景顏色
bview.blurEnabled = YES;??????????????? //是否允許模糊,默認(rèn)YES
bview.blurRadius = 10.0;?????????????? //模糊半徑
bview.dynamic = YES;?????????????????? //動態(tài)改變模糊效果
bview.iterations = 2;????????????????? //迭代次數(shù):
bview.updateInterval = 2.0;??????????? //更新時間(不確定具體功能)
/*
blurRadius = 1.0 && dynamic = 100 的效果和 blurRadius = 10.0 && dynamic = 1的效果大致相同
*/
[self.view addSubview:bview];
FXBlurView * cview = [[FXBlurView alloc] initWithFrame:CGRectMake(150, 0, 200, 200)];
cview.blurRadius = 20.0;
cview.tintColor = [UIColor whiteColor];
[self.view addSubview:cview];
}