Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/98.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 自定义UITableViewCell背景色_Ios_Uitableview_Swift - Fatal编程技术网

Ios 自定义UITableViewCell背景色

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

我想更改tablecell的背景色。 以下是代码:

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我们甚至不需要链接,很明显背景是黑色的。哦,非常感谢,我忘记了。现在可以了。哦,非常感谢,我忘了。现在可以了。哦,非常感谢,我忘了。现在可以了。哦,非常感谢,我忘了。现在很好用。