iOS get specific UITableViewCell

后端 未结 5 1797
眼角桃花
眼角桃花 2021-01-23 16:55

I have a UIButton in a custom UITableViewCell. This button triggers an event when clicked.

[myButton addTarget:self action:@selector(b         


        
5条回答
  •  误落风尘
    2021-01-23 17:26

    - (void) buttonClicked:(id)sender
    {
    
    
      UIButton *b = (UIButton*)sender;    
      UITableViewCell *tableViewCell =(UITableViewCell*) [b superview];  
    
     //if you added the UIButton as a subview of UITableViewCell contendView, use this
      UITableViewCell *tableViewCell =(UITableViewCell*) [[b superview] superview]; 
    
    } 
    

提交回复
热议问题