我有有有2个标签&一个文本框自定义单元格级表视图之间切换斯威夫特自定义单元格标注文本框
结果集将显示在标签中的所有行的一个(名字)然后有一个if else语句来显示第二个标签或文本框。
例如
标签1标签2
乔博客学生
道路亚军[文本框]
等等
然而,当行获取滚动关闭屏幕的新行标2犯规得到刷新&已经老了数据,但标签1是完美的。
例如
标签1标签2
乔博客学生
跑腿学生
等等
是代码片段
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
//let size = CGSizeMake(30, 30)
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! SBGestureTableViewCell
if strPaymentMethod[indexPath.row] == "Student" && dctMemAttEventDetails["StuDiscVenue"]! as! String == "Yes"
{
cell.txtMemberPaid.hidden = true
cell.lblPaymentMethod!.text = strPaymentMethod[indexPath.row]
}
else
{
cell.lblPaymentMethod.hidden = true
cell.txtMemberPaid.hidden = false
}
cell.lblMemberName!.text = strFirstname[indexPath.row] + " " + strSurname[indexPath.row] + " : " + strPaymentMethod[indexPath.row]
return cell
}
的要求2个截图
第二个屏幕截图显示了相同的信息,但您可以看到这个例子le行(Know itall)应该是现金&有文本框但是它有标有'学生'的标签,在第一个屏幕截图中它是正确的(如果你看得更远,你会在第二屏幕上看到其他一些不正确的东西)
我知道它与单元格在屏幕上滚动时重复使用有关,但数据没有被刷新,具体来说就是其中的if/else语句中的数据不能正确刷新/重绘。
我希望通过截图来清除你的问题/评论。如果不是,请评论&生病尝试不同的方法来显示我的问题。 如果您有任何进一步的问题让我知道尽快回答他们
感谢您的任何&所有的帮助。
This is of the tableView when first loaded & no rows scrolled off screen
This is of the tableView when scrolled down then back up
不应该在'if'子句中设置'cell.lblPaymentMethod.hidden = false'吗? – vacawama