Ios 自定义UITableViewCell背景色
我想更改tablecell的背景色。 以下是代码:Ios 自定义UITableViewCell背景色,ios,uitableview,swift,Ios,Uitableview,Swift,我想更改tablecell的背景色。 以下是代码: override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { var cell = tableView.dequeueReusableCellWithIdentifier("FirstMainViewTableCells") as! FirstMainViewTa
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("FirstMainViewTableCells") as! FirstMainViewTableCell
cell.backgroundColor = UIColor(red: 43, green: 65, blue: 87, alpha: 1)
return cell
}
结果如下:
但是它与UIColor.blackColor()和UIColor一起工作。颜色:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("FirstMainViewTableCells") as! FirstMainViewTableCell
cell.backgroundColor = UIColor.blackColor()
return cell
}
你能帮我吗?在iOS中,颜色介于
0-1
之间。您需要添加255作为因子以获得正确的颜色代码,请参见下文
cell.backgroundColor = UIColor(red: 43/255.0, green: 65/255.0, blue: 87/255.0, alpha: 1);
它应该会起作用
干杯。iOS中的颜色范围在
0-1
之间。您需要添加255作为因子以获得正确的颜色代码,请参见下文
cell.backgroundColor = UIColor(red: 43/255.0, green: 65/255.0, blue: 87/255.0, alpha: 1);
它应该会起作用
干杯。iOS中的颜色范围在
0-1
之间。您需要添加255作为因子以获得正确的颜色代码,请参见下文
cell.backgroundColor = UIColor(red: 43/255.0, green: 65/255.0, blue: 87/255.0, alpha: 1);
它应该会起作用
干杯。iOS中的颜色范围在
0-1
之间。您需要添加255作为因子以获得正确的颜色代码,请参见下文
cell.backgroundColor = UIColor(red: 43/255.0, green: 65/255.0, blue: 87/255.0, alpha: 1);
它应该会起作用
干杯。我有403错误页面,无法查看您的dropbox。@Dato'MohammadNurdin我们甚至不需要链接,很明显背景是黑色的。我有403错误页面,无法查看您的dropbox。@Dato'MohammadNurdin我们甚至不需要链接,很明显背景是黑色的。我有403错误页面,无法查看您的dropbox。@Dato'MohammadNurdin我们甚至不需要链接,很明显背景是黑色的。我收到403错误页,无法查看您的dropbox。@Dato'MohammadNurdin我们甚至不需要链接,很明显背景是黑色的。哦,非常感谢,我忘记了。现在可以了。哦,非常感谢,我忘了。现在可以了。哦,非常感谢,我忘了。现在可以了。哦,非常感谢,我忘了。现在很好用。