Jab
Jab

Reputation: 27495

How do I change UIButtons that I have inside UITableViewCells

Ok I have a UIButton inside every row of a UITableView, and I want to fade it to alpha 0 when it begins editing. Then the opposite when it goes back to normal. How do I do this?

I know what methods to use but how do I access the buttons from outside tableViewcellForRowAtIndex:?

Upvotes: 2

Views: 284

Answers (1)

Jacob Relkin
Jacob Relkin

Reputation: 163258

Well, actually, you can just call cellForRowAtIndexPath: pass in the index path that you get, and get the cell, then get the button inside of the cell and voila!

- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath {
   UITableViewCell *cell = [ tableView cellForRowAtIndexPath: indexPath ];
   UIButton *button = [ cell.contentView.subviews objectAtIndex: ... ];
   ...
}

Upvotes: 1

Related Questions