UITableViewCell,该怎么解决


UITableViewCell
我创建了一个UITableViewCell,然后在cell的每一行添加2个button,请问怎样才能获取到每个button,并且点击不同的button响应不同的事件,求救!!最好有代码和说明,3Q

移动开发 ios 程序开发

detekoi 15 years, 7 months ago

给每个button设置tag值。根据这个tag值可以取到这个button

  UIButton *btn=[self.view viewWithTag:tag];



每个button都可以使用

  [button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];


来添加点击button后的事件处理

ssewind answered 15 years, 7 months ago

button.tag        button.titleLabel.text 都可以

阿姆罗夏亚 answered 15 years, 7 months ago

Your Answer