如图所示,我想在表视图部分添加阴影 . 就像表视图有4个部分一样,表视图中会有4个阴影视图 .
func numberOfSections(在tableView:UITableView中) - > Int {return 3}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
switch processIndex {
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 44
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 40
}
1 回答
我尝试过自定义
[String : UIView]
. 这将适用于最小行数 . 如果您的单元设计是静态的,这将满足您的设计 . 如果要访问UITableViewCell
内的某些属性,则必须使用子视图 .只有一行的多个部分 . 相应行中只有一个视图(
lookView
) .我们必须根据需要以编程方式创建n个
UIView
.UITapGesture
至TableView
.TableView
格式为Grouped
,Separator
为.none
.以下代码将给出如下输出: