我的应用程序中有一个分组表视图,有两个部分。第一个由一行组成,第二个由 5 个组成。我在单元格中添加了按钮,像这样,`
UIButton *newBtn=[UIButton buttonWithType:UIButtonTypeCustom];
[newBtn setFrame:CGRectMake(5,10,35,30)];
[newBtn setImage:[UIImage imageNamed:@"icon.png"] forState:UIControlStateNormal];
[newBtn addTarget:self action:@selector(selector:) forControlEvents:UIControlEventTouchUpInside];
newBtn.tag=4;
[cell.contentView addSubview:newBtn];
Now in that selector methode i need to change it with another image.I am trying to do that in this way
UITableViewCell *cell=(UITableViewCell *)[sender superview];
NSIndexPath *path=[self.mtableview indexPathForCell:cell];
`但是在某些时候出现瓶颈。任何人都可以将我指向正确的方向吗?