开发者

How do I change UIButtons that I have inside UITableViewCells

开发者 https://www.devze.com 2022-12-29 10:44 出处:网络
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?

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

精彩评论

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

关注公众号