layoutSubviews、layoutIfNeeded、setNeedsLayout...
毛玻璃效果
//創(chuàng)建圖片
self.view.backgroundColor = [UIColor blackColor];
self.blurImageView = [[UIImageView alloc]initWithFrame:self.view.bounds];
[self.blurImageView sd_setImageWithURL:[NSURL URLWithString:@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1498707379&di=a924ec5370156b954c80b44b0324d8e1&imgtype=jpg&er=1&src=http%3A%2F%2Fpic.ffpic.com%2Ffiles%2F2014%2F0531%2F0530xgmycmnsjbz2.jpg"] placeholderImage:[UIImage imageNamed:@"default_room"]];
self.blurImageView.contentMode = UIViewContentModeScaleAspectFill;
self.blurImageView.clipsToBounds = true;
[self.view addSubview:self.blurImageView];
//毛玻璃效果
UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
//創(chuàng)建毛玻璃視圖
UIVisualEffectView *visualView = [[UIVisualEffectView alloc]initWithEffect:blur];
visualView.frame = self.blurImageView.bounds;
[self.blurImageView addSubview:visualView];
添加到window
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
view.backgroundColor = [UIColor blackColor];
view.alpha = 0.5;
[[UIApplication sharedApplication].keyWindow addSubview:view];
視圖移到最前和最后
將一個(gè)UIView顯示在最前面只需要調(diào)用其父視圖的 bringSubviewToFront()方法酣衷。
將一個(gè)UIView層推送到背后只需要調(diào)用其父視圖的 sendSubviewToBack()方法怀酷。
移除指定視圖
//創(chuàng)建時(shí)要指定tag值
self.guideView = [[UIView alloc]init];
self.guideView.tag = 120;
//移除
UIView *subview = [self.guideView viewWithTag:120];
[subview removeFromSuperview];
勤學(xué)如早春之苗毯盈,不見(jiàn)其增缀壤,日有所漲。
輟學(xué)如磨刀之石餐塘,不見(jiàn)其減妥衣,日有所損。