0
工作,我想進行自定義的角落圓角背景爲我定製的細胞,並將其與下面的代碼的工作,但第一行是不會受到影響,我應該把它的滾動起來,使其有一個背景willDisplayCell第一行不斯威夫特
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
if indexPath.row != 0 {
cell.contentView.backgroundColor = UIColor.clearColor()
var whiteRoundedCornerView: UIView = UIView(frame: CGRectMake(10, 10, 365, 250))
whiteRoundedCornerView.backgroundColor = UIColor.lightGrayColor()
whiteRoundedCornerView.layer.masksToBounds = false
whiteRoundedCornerView.layer.cornerRadius = 20
whiteRoundedCornerView.layer.shadowOffset = CGSizeMake(-0, -1)
whiteRoundedCornerView.layer.shadowOpacity = 0.1
cell.contentView.addSubview(whiteRoundedCornerView)
cell.contentView.sendSubviewToBack(whiteRoundedCornerView)
}
}
爲什麼你有'if indexPath.row!= 0'? – kabiroberai
在這種情況下,我會將其作爲答案發布,以便其他人可以看到問題已解決 – kabiroberai