I have a table view that has a custom cell class that has 2 labels & a textbox
the result set would display one of the labels for all rows (a name) then there is a if else statement to show either the second label or a textbox.
example
label 1 label 2
joe blogs Student
road runner [TextBox]
etc...
however when rows gets scrolled off screen new rows label 2 doesnt get refreshed & has old data, however label 1 is perfect.
example
label 1 label 2
joe blogs Student
road runner Student
etc...
below is the code snippet
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
}
as requested 2 screenshots
the second screenshot shows the same info but as you can see for example the row (Know itall) should be cash & have the textbox however it has the label which says 'student' where on the first screenshot it is correct (you will see some others incorrect on the second screenshot if you look further down)
I know it has to do with the cells getting reused when they scroll off screen but the data not getting refreshed & its specifically the data in the if/else statement thats not refreshing/redrawing properly.
I hope that clears your questions/comments with the screenshots of what i'm trying to achieve. if not please comment & ill try to a different approach to showing my problem. if you have any further questions let me know ill answer them as soon as possible
thank you for any & all assistance.
This is of the tableView when first loaded & no rows scrolled off screen
This is of the tableView when scrolled down then back up