我有一个视图控制器,显示两个集合视图。我现在想要从两个集合视图到不同的目标控制器。我在下面有这个代码,但没有运气。
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
JSTRCollectionViewCell *selectedCell = (JSTRCollectionViewCell *)sender;
JSTRBrowserViewController *targetVC = (JSTRBrowserViewController *) [segue destinationViewController];
targetVC.ndesc = selectedCell.description.text;
targetVC.ntitle = selectedCell.title.text;
targetVC.nimage = selectedCell.image.image;
targetVC.ncat = selectedCell.category.text;
targetVC.ndate = selectedCell.date.text;
SliderCollectionViewCell *selectedCell1 = (SliderCollectionViewCell *)sender;
SliderBrowserViewController *targetVC1 = (SliderBrowserViewController *) [segue destinationViewController];
targetVC1.sldesc = selectedCell1.description.text;
targetVC1.sldate = selectedCell1.date.text;
targetVC1.slcat = selectedCell1.category.text;
targetVC1.sltitle = selectedCell1.title.text;
targetVC1.slimage = selectedCell1.image.image;
}
答案 0 :(得分:0)
我将此添加到collectionview单元格
[self performSegueWithIdentifier:@"String" sender:indexPath];
并在segue中添加了if语句并解决了问题。