Код: Выделить всё
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "HomePageTVC", for: indexPath) as! HomePageTVC
cell.post.text = Posts[indexPath.row]
cell.fullname.setTitle(FullName[indexPath.row],for: UIControlState.normal)
cell.fullname.tag = indexPath.row
cell.fullname.addTarget(self, action: #selector(HomePageC.Fullname_Click(sender:)), for: .touchUpInside)
cell.comments.setTitle(Comments[indexPath.row],for: UIControlState.normal)
cell.comments.tag = indexPath.row
cell.votes.setTitle(Votes[indexPath.row],for: UIControlState.normal)
cell.votes.tag = indexPath.row
cell.time.text = Times[indexPath.row]
cell.shares.setTitle(Shares[indexPath.row],for: UIControlState.normal)
cell.shares.tag = indexPath.row
cell.location.text = Locations[indexPath.row]
return cell
}
< /code>
userprofilec < /strong> code < /p>
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "UserProfileTVC", for: indexPath) as! HomePageTVC
cell.post.text = Posts[indexPath.row]
cell.fullname.setTitle(FullName[indexPath.row],for: UIControlState.normal)
cell.fullname.tag = indexPath.row
cell.fullname.addTarget(self, action: #selector(HomePageC.Fullname_Click(sender:)), for: .touchUpInside)
cell.comments.setTitle(Comments[indexPath.row],for: UIControlState.normal)
cell.comments.tag = indexPath.row
cell.votes.setTitle(Votes[indexPath.row],for: UIControlState.normal)
cell.votes.tag = indexPath.row
cell.time.text = Times[indexPath.row]
cell.shares.setTitle(Shares[indexPath.row],for: UIControlState.normal)
cell.shares.tag = indexPath.row
cell.location.text = Locations[indexPath.row]
cell.vote_status.text = Votes[indexPath.row]
return cell
}
Подробнее здесь: https://stackoverflow.com/questions/431 ... reuse-them
Мобильная версия