ArtSabintsev
ArtSabintsev

Reputation: 5180

How do I edit the same UILabel in every row of a TableView

I have TableView with a custom TableViewCell loaded from an external nib file. Each cell has a UILabel that needs to be hidden each time the edit button is pressed in the parent Navigation Controller.

Is there a UITableViewDelegate or UITableViewDatasource protocol method that I can use that will let me change the alpha level or employ the setHidden property on each and every visible UILabel from each instance of the TableViewCell (e.g., for all indexPath.row)?

Thanks!

Upvotes: 0

Views: 195

Answers (1)

jrturton
jrturton

Reputation: 119242

[tableView visibleCells] returns an array of all the cells that are visible at the moment. In your tableViewController's setEditing method you can use this to configure the existing cells.

You will also need to modify your cellForRowAtIndexPath method so that newly dequeued cells have the label set to visible / invisible as appropriate, depending on tableView.editing.

If your cell was a custom subclass you could override setEditing: animated: and make the changes there .

Upvotes: 3

Related Questions