TableViewHeaderFooterBackGroundColor

警告提示:
[TableView] Setting the background color on UITableViewHeaderFooterView has been deprecated. Please set a custom UIView with your desired background color to the backgroundView property instead.
原因:

实现自定义tableHeaderView,因为有不规则图片,需要背景透明,打开图层发现默认有一个灰色背景,如果直接设置self.backGroundColor = [UIColor clearColor];就会出现上述报错,意思为:直接设置UITableViewHeaderFooterView的background color 已经被废弃 ,你可以自定义一个view,设置好自定义view的背景颜色,然后用这个view来代替backgroundView。

解决办法:

我是自定义的tableHeaderView,在.m初始化方法中添加;完美实现默认灰色背景设置成透明。

UIView * view = [[UIView alloc] initWithFrame:self.bounds];
view.backgroundColor = [UIColor clearColor];
self.backgroundView = view;
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容