直接贴代码
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellView = super.tableView(tableView, cellForRowAtIndexPath: indexPath)
cellView.contentView.snp_remakeConstraints(closure: { (make) in
make.top.bottom.equalTo(cellView)
make.left.equalTo(10)
make.right.equalTo(-10)
})
cellView.backgroundColor = UIColor.clearColor()
cellView.contentView.backgroundColor = UIColor.whiteColor()
return cellView
}
![](https://img.haomeiwen.com/i2034440/cbfdb9d9ff9f66db.png)
对于时间控件,会出现对齐问题
加入如下代码
<<< DateRow(){
$0.title = "时间:"
$0.value = NSDate()
let dateCell = $0.cell as DateCell
dateCell.textLabel?.snp_makeConstraints(closure: { (make) in
make.left.equalTo(8)
make.centerY.equalTo((dateCell.textLabel?.superview)!)
})
dateCell.detailTextLabel?.snp_makeConstraints(closure: { (make) in
make.right.equalTo(-8)
make.centerY.equalTo((dateCell.detailTextLabel?.superview)!)
})
网友评论