0
我正在嘗試創建手風琴tableview
。在這裏我可以很容易地得到parent tableview
選定的單元格索引路徑值,但我不能得到子表(可擴展child
tableview單元格)row index path
。請給我要我的問題的任何解決方案,找到下面的代碼如何使用Objective C獲取子單元的IndexPath第一節tableview?
我的代碼:
// @optional
- (void)didSelectRowAtChildIndex:(NSInteger)childIndex underParentIndex:(NSInteger)parentIndex {
NSIndexPath * indexPath = [NSIndexPath indexPathForRow:[self rowForParentIndex:parentIndex] inSection:0];
UITableViewCell *selectedCell = [self cellForRowAtIndexPath:indexPath];
if ([selectedCell isKindOfClass:[ParentTableViewCell class]]) {
//ParentTableViewCell * pCell = (ParentTableViewCell *)selectedCell;
// Insert code here to detect and handle child cell selection
// ...
}
}
我對開放源碼檢查:選擇兒童https://github.com/ajkoshy7/SubTable
太棒了!謝謝! @Irfan – android
很高興幫助你。同時檢查修改後的答案。 – Irfan