小编mit*_*h94的帖子

TableView圆角和阴影

我有三行的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)

storyboard uitableview tableview ios swift

11
推荐指数
2
解决办法
2万
查看次数

标签 统计

ios ×1

storyboard ×1

swift ×1

tableview ×1

uitableview ×1