在需要模糊的UIView上,,添加一个UIVisualEffectView对象即可,若直接在storyboad里面直接加UIVisualEffectView,你的项目必须是iOS8以上才能用
– (void)viewDidLoad {
[superviewDidLoad];
// UIImageView *imageview = [[UIImageView alloc] init];
//
// imageview.frame = CGRectMake(10, 200, 300, 300);
//
// imageview.image = [UIImage imageNamed:@"2"];
//
// imageview.contentMode = UIViewContentModeScaleAspectFit;
//
// imageview.userInteractionEnabled = YES;
//
// [self.view addSubview:imageview];
effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *effectview = [[UIVisualEffectView
// effectview.frame = CGRectMake(0, 0, imageview.frame.size.width/2, 300);
effectview.frame =,view.frame.size.width,self.view.frame.size.height);
//[imageview addSubview:effectview];
[self.viewaddSubview:effectview];
buttonWithType:UIButtonTypeSystem];
btn.frame =CGRectMake(10,50, 100, 40);
[btn setTitle:@"btn"forState:UIControlStateNormal];
[effectview.contentViewaddSubview:btn];
}
让我们将事前的忧虑,换为事前的思考和计划吧!