【发布时间】:2023-04-01 21:42:01
【问题描述】:
我正在使用 firebase 数据库,并在 index path.row 有一个表格视图,显示用户的姓名、年龄、位置和图像。当单击单元格以显示包含更多信息和用户照片的用户个人资料时,我将如何显示另一个视图。这是我的 tableView 的代码。
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return userList.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "prefCell", for: indexPath) as! SFPTableViewCell
let user = userList[indexPath.row]
cell.name.text = userList[indexPath.row].name
cell.location.text = userList[indexPath.row].location
if let imageURL = user.image {
cell.imageOne.loadImageUsingCacheWithUrlString(urlString: imageURL)
}
return cell
}
}
【问题讨论】:
-
添加表格视图委托“didSelectRowAtIndexPath”
标签: swift uitableview firebase firebase-realtime-database tableview