今天偶尔看见tableview 属性,看见了tableview 分割线毛玻璃效果,于是就看了下效果!
- (void)viewDidLoad {
[superviewDidLoad];
// 设置了一个背景图片
self.tableView.backgroundColor=[UIColorclearColor];
UIImageView *backImageView = [[UIImageViewalloc]initWithImage:[UIImageimageNamed:@"test.jpeg"]];
self.tableView.backgroundView = backImageView;
// 设置毛玻璃
UIBlurEffect *blurEffect = [UIBlurEffecteffectWithStyle:UIBlurEffectStyleDark];
UIVibrancyEffect *vibrancyEffect = [UIVibrancyEffecteffectForBlurEffect:blurEffect];
self.tableView.separatorEffect = vibrancyEffect;
记得要把cell 设置成透明效果}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
return 18;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableViewdequeueReusableCellWithIdentifier:@"cell"forIndexPath:indexPath];
cell.backgroundColor = [UIColorclearColor];
cell.textLabel.text =@"秀才";
return cell;
}
效果图