细胞看法披露按钮与对策研究方法

问题描述:

我一直在努力与细胞disclosue按钮...首先,它是说这是因为我用的是贬值:细胞看法披露按钮与对策研究方法

-(UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath { 
return UITableViewCellAccessoryDetailDisclosureButton; 
} 

所以我评论说出来,并添加了披露使用在configureCell细胞:

cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 
cell.editingAccessoryType = UITableViewCellAccessoryNone; 

但是现在我披露按钮什么都不做。我需要添加什么才能让揭示按钮生效。我所有的Google搜索都提出了其他折旧方法。任何帮助或指针将不胜感激。

如果你真的想要一个详细披露按钮,请确保你你的附件类型设置为UITableViewCellAccessoryDetailDisclosureButton。 (您的示例代码显示为UITableViewCellAccessoryDisclosureIndicator。)您在表格视图代理的tableView:accessoryButtonTappedForRowWithIndexPath:方法中处理详细披露按钮。您在表格视图代表tableView:didSelectRowAtIndexPath:方法中处理行选择(无论配件视图是什么)。

+0

这就是我出错的地方。我的图标只是>不是>,因此当我将类型更改为UITableViewCellAccessoryDe​​tailDisclosureButton时,它的工作方式与之前一样。感谢您的高举 – Designer023 2010-10-02 20:55:58

使用此方法在您的表视图代表

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath 
+0

我用这个已经,原来,因为我使用的是UITableViewCellAccessoryDisclosureIndicator而不是UITableViewCellAccessoryDe​​tailDisclosureButton,它没有调用它:)所有修复和现在工作。感谢您的帮助 – Designer023 2010-10-02 20:57:42

委托方法在雨燕3.0

func tableView(_ tableView: UITableView, accessoryButtonTappedForRowWith indexPath: IndexPath) { 

} 

但对于使用该委托: 你可以用下面的两个附件类型之一:

cell.accessoryType = .detailDisclosureButton 
cell.accessoryType = .detailButton