有UITableViewCell哪些包含UIButton.
在我的cellForRowAtIndexPath中:
cell.toCartBtn.tag = indexPath.row;
[cell.toCartBtn addTarget:self
action:@selector(toCart:) forControlEvents:UIControlEventTouchDown];
Run Code Online (Sandbox Code Playgroud)
在toCart方法中,我需要通过tapped按钮标记获取行和节.我该怎么做?
小智 10
看到这段代码
- (void)toCart:(id)sender
{
CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:self.tableView];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:buttonPosition];
if (indexPath)
{
...
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3596 次 |
| 最近记录: |