![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
如何去掉grouped样式UITableView中cell的边框和背景求解
1个回答
展开全部
_tableView.backgroundView = nil;可以搞定。
测试下发现确实可以,但是不知道以前的版本不确定有没有backgroundView的,所以最好加个判断吧:if(mainTableView.
backgroundView){
mainTableView.
backgroundView=nil;}如果类型为UITableViewStylePlain,[UIColor clearColor]仍然有效,怪哉!
正常情况下grouped样式(
UITableViewStyleGrouped
)UITableViewCell都是有边框的,如果要去掉边框可以用:
UIView *tempView = [[[UIView alloc] init] autorelease];
[cell setBackgroundView:tempView];
其实很简单,把backgroundView设置为一个空的View,然后就干净了。
测试下发现确实可以,但是不知道以前的版本不确定有没有backgroundView的,所以最好加个判断吧:if(mainTableView.
backgroundView){
mainTableView.
backgroundView=nil;}如果类型为UITableViewStylePlain,[UIColor clearColor]仍然有效,怪哉!
正常情况下grouped样式(
UITableViewStyleGrouped
)UITableViewCell都是有边框的,如果要去掉边框可以用:
UIView *tempView = [[[UIView alloc] init] autorelease];
[cell setBackgroundView:tempView];
其实很简单,把backgroundView设置为一个空的View,然后就干净了。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询