美文网首页
tableview修改selectedBackgroundVie

tableview修改selectedBackgroundVie

作者: 锦鲤跃龙 | 来源:发表于2017-11-13 14:08 被阅读0次

思路

  1. selectedBackgroundView的frame无法修改,但可以替换
  2. 在替换的view上加上view,并设置这个view的frame

代码

 UIView* selectBackview = [[UIView alloc] init];
        
        selectBackview.backgroundColor = [UIColor clearColor];
     
        UIView* backview = [[UIView alloc] initWithFrame:cell.mainView.frame];
        
        backview.backgroundColor = RGBAlphaColor(183,207,232,0.4);
        
        
        [selectBackview addSubview:backview];
        
        cell.selectedBackgroundView = selectBackview;
        

效果图

这里写图片描述

相关文章

网友评论

      本文标题:tableview修改selectedBackgroundVie

      本文链接:https://www.haomeiwen.com/subject/jjlzmxtx.html