0
Я хотел создать собственный угловой округленный фон для своих пользовательских ячеек, и он работал с кодом ниже, но первая строка не была затронута. Я должен прокрутить его, чтобы он имел фонwillDisplayCell первая строка не работает в Swift
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