记录didSelectRowAtIndexPath中的特定行

And*_*dyy 1 cocoa-touch objective-c uitableview didselectrowatindexpath ios

在方法中

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // do stuff here
}
Run Code Online (Sandbox Code Playgroud)

我有一个分组表视图.如果我想要第1部分的第1行吐出来NSLog,我该怎么做?另外,如果我想要第3部分的第2行来制作日志,会不同?到目前为止,我只使用这种方法在笔尖之间转换.

Jac*_*kin 6

污垢简单:

if(indexPath.row == 1 && indexPath.section == 1) {
  NSLog(@"Awesomeness");
} else if(indexPath.row == 2 && indexPath.section == 3) {
  NSLog(@"Something more awesome");
}
Run Code Online (Sandbox Code Playgroud)