1在实现didSelectRowAtIndexPath基础上:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([self.delegate respondsToSelector:@selector(ZJCViewController:didselectArray:)]){
categoriesModel *model = _categories[indexPath.row];
[self.delegate ZJCViewController:self didselectArray:model.subcategories];
}
}
2 再viewdidload方法里面添加:
// 默认选中左边表格的第0行
[self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:NO scrollPosition:UITableViewScrollPositionTop];
//实现点击第一行所调用的方法
[self tableView:self.tableView didSelectRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]];
3 则点击进入下个页面时候,自会把单行数据传入