I have a uitableview with a custom cell that gets data from an array. The user cell has uilabel and uibutton (which is not visible until the uilabel text or the array object that is loaded for the text is non-zero).
At startup, everything is fine. When I click uibutton , the array is added, new cells are inserted under the cell.
But when I scroll - suddenly uibutton appears in other cells where this conditional uilabel text isEmpty not implied.
Here is the whole process 
Here is my code for cellForRowAtIndexPath
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { var cell:TblCell = self.tableView.dequeueReusableCellWithIdentifier("cell") as! TblCell cell.lblCarName.text = someTagsArray[indexPath.row] if let text = cell.lblCarName.text where text.isEmpty { cell.act1.hidden = false } else { println("Failed") } cell.act1.setTitle(answersdict[answersdict.endIndex - 2], forState:UIControlState.Normal) cell.act2.setTitle(answersdict.last, forState:UIControlState.Normal) return cell }
So, my general question is: how to stop the reuse of these custom cells? As far as I know, there is no direct way to do this on the reusablecellswithidentifier in swift, but maybe there are some workarounds for this problem?
source share