【发布时间】:2019-02-20 08:31:42
【问题描述】:
有一个表格视图单元格,并且有一个更多按钮位于表格视图上而不是单元格中,所以我希望当项目运行时它在表格视图单元格中仅显示五个用户数据,而其他用户数据显示时用户点击更多按钮(位于单元格外侧)我如何实现这一点?
感谢您的帮助
你可以找到原型细胞图像
//Mark:TableViewDelegate
extension MembersViewController:UITableViewDelegate,UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return imgarray.count
}
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tblView.dequeueReusableCell(withIdentifier: "membTableCell", for: indexPath) as! membTableCell
cell.profiletabImg.image = imgarray[indexPath.row]
cell.namelbl.text = names[indexPath.row]
cell.positionlbl.text = "Ceo of code with color"
return cell
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 40
}
@IBAction func morebutton(sender:UIButton){
}
}
【问题讨论】:
-
贴出你试过的代码。
标签: swift