ios 怎么点击cell上的button来获取cell的值

2025-05-13 18:15:54
推荐回答(1个)
回答1:

根据tag值进行获取,在这里设置tag值, 然后在方法 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 中进行获取这个tag值,获取方法是: UIButton *exitBtn = (UIButton *)[cell viewWithTag:1];//1是我上面设置的tag值 这样就获取到了,你再给他添加action事件就可以了,