これは私が使用しているコードであり、テーブルビューでスクロールしてセルが互いに上書きされ、すべてのrepostedFromLabelが非表示にされるまで正常に動作します。再利用可能なカスタムセルがスクロールするときにデータを上書きしないようにするにはどうすればよいですか?
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("FeedsTableViewCell", forIndexPath: indexPath) as? FeedsTableViewCell
if (arrayofPostsFeed[indexPath.row].postedByUser!.nickName!) != arrayofPostsFeed[indexPath.row].ownedByUser!.nickName! {
cell!.repostedFromLabel.text! = "Reposted From \(self.arrayofPostsFeed[indexPath.row].postedByUser!.nickName!)"
} else {
cell!.repostedFromLabel.hidden = true
}
}
再利用可能なセルが互いにオーバーライドしないようにするにはどうすればよいですか?
完全にそれらを設定することにより、それらを適切に再利用... – Wain
トライセル!.repostedFromLabel.hidden = falseのあなたの状態は、それが働いた – stosha