我想创建表格,当点击表格中的单元格时,内容将显示在另一个视图中。每个表都有不同的设计。我怎么做。
我发布图片不够,你可以在这个链接中看到。感谢。
答案 0 :(得分:2)
使用此委托方法:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:@"InstructionToSection" sender:nil]; //"InstructionToSection" is seque name
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
InstructionSectionViewController * instructSection = [segue destinationViewController]; // InstructionSectionViewController is ur next viewcontroller. 1st u need to import your destination viewcontroller in header
instructSection.SelectedItem = @"Ur Passing value"; // selectedItem should be declare in InstructionSectionViewController as property, need to synthesize
}
有关详细信息,请参阅此link