开发者

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 norm开发者_如何学Cal. How do I do this?

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


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: ... ];
   ...
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜