表格查看来自iphone的单元格值

时间:2009-10-02 06:42:28

标签: iphone uitableview

当我点击它时,我只想获取表格视图中单元格的值。任何人都可以帮助我。?

先谢谢 Shibin Moideen

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{
    appDelegate.courseName=[appDelegate.courses objectAtIndex:indexPath];
    NSLog(@"%@",appDelegate.courseName);
    DetailCourseViewController *detailController = [[DetailCourseViewController alloc]
                                                       initWithNibName:@"DetailCourseView" bundle:nil];
    [self presentModalViewController:detailController animated:YES];
}

是以这种方式完成的。我还需要将该值存储在我在app delegate中声明的字符串中。

1 个答案:

答案 0 :(得分:1)

您使用tableView:didSelectRowAtIndexPath:委托方法并使用indexPath返回被点按的单元格。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    NSLog(@"%@", cell);
}