W
W
wolfak2019-06-14 09:31:42
iOS
wolfak, 2019-06-14 09:31:42

How to get UITableView Cell style with padding of 15 and rounded edges?

Hello.
How to get UITableView Cell style with padding of 15 and rounded edges? I found a lot of information on how to change the size of separator, but together with rounded edges it doesn't work. I need your help. Thanks a lot.
I use:

let columnHeight = CGFloat(60.0)
1.
let viewSeparatorLine = UIView(frame:CGRect(x: 0, y: cell.contentView.frame.size.height - columnHeight, width: cell.contentView.frame.size.width, height: 15))
ИЛИ
2.
let viewSeparatorLine = UIView(frame:CGRect(x: 0, y: cell.contentView.frame.size.height - 15.0, width: cell.contentView.frame.size.width, height: 15))
И
viewSeparatorLine.backgroundColor = UIColor(red: 245/255, green: 245/255, blue: 245/255, alpha: 1.0)
cell.contentView.addSubview(viewSeparatorLine)

Закругление:
cell.layer.cornerRadius = 5
cell.layer.borderColor = UIColor(red: 245/255, green: 245/255, blue: 245/255, alpha: 1.0).cgColor
cell.layer.masksToBounds = true

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Vorobei, 2019-06-14
@wolfak

To you need to use UICollectionView .
The author of the question wants to make a collection, but based on a table. There is no such table tool. But you can crutch:

  • Set the height for the cell to half the indents more, place the view with the content in the center
    Add a separator line at the end of each cell. Or if you want a crutch - then in the headerView for the table. What you want to do is many times faster with UICollectionView. Use a collection.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question