#StackBounty: #swift #uitableview #border #cell Wallet style with multiple cells border Swift

Bounty: 50

How do I make only the last cell with round corner and black border color? and the rest of the cell will only have left and right border?

This is the design of the cell. The pink part is the section header, the white part is the cell. In the image I have 6 cells and I want the 6th one to have round corner and black border. Cell 1-5 will only have left and right border.

My tableview will contain few sets of todo please see the image under.

Thank you.

enter image description here

enter image description here

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
         .    
         .
         .

    cell.view.clipsToBounds = true

    if indexPath.row == todoList.count - 1 {
        cell.view.layer.cornerRadius = 10
        cell.view.layer.maskedCorners = [.layerMinXMaxYCorner,.layerMaxXMaxYCorner]
        cell.view.layer.borderColor = UIColor.black.cgColor   //not working it makes all cell has border
        cell.view.layer.borderWidth = 1
       
    } else {
        //only want left and right with black border
    }
        .    
        .
        .
}


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.