TableViewCell in Swift?



我在Objective C中有这个代码,想知道你是否可以将它翻译成新的swift Xcode。。。这是代码。

  (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
NSString *cellText = cell.textLabel.text;
 }

这应该是正确的:

func tableView(tableView: UITableView, indexPath: NSIndexPath) {
   let cell = tableView.cellForRowAtIndexPath(indexPath);
   let cellText = cell.textLabel.text;
 }

最新更新