所以我想获取我选择的行的textLabel的值.我试过打印它,但它没有用.经过一些研究,我发现这段代码有效,但仅限于Objective-C;
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"did select and the text is %@",[tableView cellForRowAtIndexPath:indexPath].textLabel.text);]
}
Run Code Online (Sandbox Code Playgroud)
我找不到Swift的任何解决方案.虽然打印indexpath.row是可能的,但这不是我需要的.
所以我该怎么做?或者这段代码的"Swift版本"是什么?