iPhone - How to determine in which cell a button was pressed in a custom UITableViewCell

后端 未结 10 1873
遥遥无期
遥遥无期 2021-01-01 15:45

I currently have a UITableView that is populated with a custom UITableViewCell that is in a separate nib. In the cell, there are two buttons that are wired to actions in th

10条回答
  •  借酒劲吻你
    2021-01-01 16:07

        [btnFavroite setAccessibilityValue:[NSString stringWithFormat:@"%d",indexPath.row]];
        [btnFavroite setAccessibilityLabel:btnFavroite.titleLabel.text];
        [btnFavroite addTarget:self action:@selector(btnFavClick:) forControlEvents:UIControlEventTouchUpInside];
    
    -(void)btnFavClick:(id)sender{
        UIButton *btn=(UIButton *)sender;
        int index=[btn.accessibilityValue integerValue]]
    }
    

提交回复
热议问题