一般在storyboard中传值通过identifier的值来控制segue的跳转和传值,但是,如果在tableView中,由于cell特别多,不可能创建n个identifier标识符,这里通过NSIndexPath *indexPath = [_tableView indexPathForSelectedRow];
的方法来获取当前选中的cell,这样拿到IndexPath就可以拿到model了并进行传值了
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
//获取当前点击的cell的IndexPath
NSIndexPath *indexPath = [_tableView indexPathForSelectedRow];
TYItemModel *model = self.dataArr[indexPath.row];
TYLiveViewController *liveVC = (TYLiveViewController *)segue.destinationViewController;
liveVC.model = model;
NSLog(@"%@",indexPath);
}