How can I make the edges of my table look rounded and not straight. as in each line.
And add a shadow to the table
The edges of the table are round
put your table in a UIView
container (the table with constraints 0 to the 4 edges of this view)
@IBOutlet weak var containerView: UIView!
@IBOutlet weak var tableview: UITableView!
then you can do, for example in ViewDidLoad
:
override func viewDidLoad() {
super.viewDidLoad()
// bordes redondeados
self.tableview.layer.cornerRadius = 5.0
self.tableview.layer.masksToBounds = true
// sombras
self.containerView.layer.masksToBounds = false
self.containerView.layer.shadowColor = UIColor.black.cgColor
self.containerView.layer.shadowOffset = CGSize(width: 0, height: 5)
self.containerView.layer.shadowOpacity = 0.5
self.containerView.backgroundColor = UIColor.clear
}
To make the rounded edges you can make:
self.tableView.layer.cornerRadius = 5 //Este valor es el radio que van a tener los bordes