在 objective-c 中,我曾经像下面这样检查
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (!indexPath.row) {
NSLog(@"section");
} else {
NSLog(@"row");
}
}
如何用 Swift 做同样的事情?
最佳答案
indexPath.row 它并不意味着一个部分。您可以通过编写indexPath.section 来获取节索引。想想一个二维数组。每个部分都有自己的行。想想吧。希望对您有所帮助。
关于ios - 如何快速检查表格 View 单元格是行还是部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47391155/