Jac*_*e11 0 iphone objective-c uibutton uitableview
在UITableviewCell.accessoryview上,我希望-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath在touchUpInside操作上调用该方法.关于如何实现这一点的任何想法都会很棒.
我建议将表视图单元格的accessoryView属性UIButton设置为自定义实例,然后设置自定义选择器来处理您想要执行的任何触摸事件:( 此代码未经过测试,仅供参考)
UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[button addTarget:self action:@selector(actionSelector) forControlEvents:UIControlEventTouchDown];
cell.accessoryView = button;
Run Code Online (Sandbox Code Playgroud)
您可以actionSelector使用您选择的自定义选择器以及您想要的UIControlEventTouchDown任何事件标志来替换,例如UIControlEventTouchUpInside(操作选择器的更多详细信息).
希望有所帮助.
| 归档时间: |
|
| 查看次数: |
2251 次 |
| 最近记录: |