Custom UITableViewCell - Add a field between each cell

Can a marker be applied between UITableView cells?

A brief query requires the table cells to look lower -

enter image description here

I have my own cell class for background styles / fonts / individual labels, but I can't figure out how to apply any spacing!

+4
source share
3 answers

: -, , background UITableViewCell contentView [UIColor clearColor], , contentView ( height = CGRectGetHeight(contentView) - margin) , . backgroundView UITableView, .

+9

TableView Swift.

func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {

    cell.contentView.backgroundColor=UIColor.clearColor()

    var whiteRoundedCornerView:UIView!
    whiteRoundedCornerView=UIView(frame: CGRectMake(5,10,self.view.bounds.width-10,120))
    whiteRoundedCornerView.backgroundColor=UIColor(red: 174/255.0, green: 174/255.0, blue: 174/255.0, alpha: 1.0)
    whiteRoundedCornerView.layer.masksToBounds=false
    whiteRoundedCornerView.layer.shadowOpacity = 1.55
    whiteRoundedCornerView.layer.shadowOffset = CGSizeMake(1, 0);
    whiteRoundedCornerView.layer.shadowColor=UIColor(red: 53/255.0, green: 143/255.0, blue: 185/255.0, alpha: 1.0).CGColor
    whiteRoundedCornerView.layer.cornerRadius=3.0
    whiteRoundedCornerView.layer.shadowOffset=CGSizeMake(-1, -1)
    whiteRoundedCornerView.layer.shadowOpacity=0.5
    cell.contentView.addSubview(whiteRoundedCornerView)
    cell.contentView.sendSubviewToBack(whiteRoundedCornerView)
}
+2

funsubviews() .

contentView.frame = contentView.frame.inset(by: UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10))
-4

All Articles