如何在ios中以编程方式设置UITableView背景色
我以编程方式创建了UITableView。我想更改UITableView的背景颜色,如下所示。提前感谢如何在ios中以编程方式设置UITableView背景色,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我以编程方式创建了UITableView。我想更改UITableView的背景颜色,如下所示。提前感谢 self.tableView.backgroundColor = UIColor.redColor() 获取RGB值并执行所需的全部操作 self.tableView.backgroundColor = UIColor(red: 200.0/255.0, green: 16.0/255.0, blue: 46.0/255.0, alpha: 1.0) 目标C self.tableView.
self.tableView.backgroundColor = UIColor.redColor()
获取RGB值并执行所需的全部操作
self.tableView.backgroundColor = UIColor(red: 200.0/255.0, green: 16.0/255.0, blue: 46.0/255.0, alpha: 1.0)
目标C
self.tableView.backgroundColor = [UIColor redColor];
self.tableView.backgroundColor = [UIColor colorWithRed:200.0/255.0 green:200.0/255.0 blue:200.0/255.0 alpha:1.0];
在您的代码中尝试此代码
self.YourTableName.backgroundColor = [UIColor PurpleColor];
self.YourTableName.backgroundColor = [UIColor colorWithRed:200.0/255.0 green:200.0/255.0 blue:200.0/255.0 alpha:1.0];
及
Set tableView backgroundColor将更改所有tableView的颜色,但tableView被单元格覆盖。所以你看不见。如果要查看更改,可以设置cell.contentView.backgroundColor
cell.contentView.backgroundColor = [UIColor greenColor];
非常感谢。请您指导我如何设置精确的RGB颜色程序。根据颜色选择器,您的颜色值为[UIColor color WITH RED:0.827f green:0.780f blue:0.824f alpha:1.00f]。您还必须使每个单元格的背景色相同,以实现发布的屏幕。cell.backgroundColor=[UIColor colorWithRed:0.827f green:0.780f blue:0.824f alpha:1.00f];或者您可以只清除单元格的背景色您的RGB是[UIColor COLOR WITHRED:211.0/255.0 green:200.0/255.0 blue:210.0/255.0 alpha:1.0];用ClearColor更正打字错误。。cell.backgroundColor=[UIColor clearColor];又好又容易。像那样。。谢谢
cell.contentView.backgroundColor = [UIColor greenColor];