我有三行的tableview.我试图使表行有圆角,并在整个tableview周围也有阴影效果.出于某种原因,我无法使tableview都具有圆角和阴影效果,但如果我注释掉负责其中一个功能的代码,我可以单独执行它们.这是我正在使用的代码:
//this is for shadow effect
tableView.backgroundColor = UIColor.clearColor()
tableView.layer.shadowColor = UIColor.darkGrayColor().CGColor
tableView.layer.shadowOffset = CGSize(width: 2.0, height: 2.0
tableView.layer.shadowOpacity = 1.0
tableView.layer.shadowRadius = 2
// This is for rounded corners
tableView.layer.cornerRadius = 10
tableView.layer.masksToBounds = true
Run Code Online (Sandbox Code Playgroud)