0

我有一个视图控制器,其中显示了两个集合视图。我现在想从两个集合视图转移到不同的目标控制器。我在下面有这段代码,但没有运气。

- (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;
}
4

1 回答 1

0

我将此添加到 collectionview 单元格

    [self performSegueWithIdentifier:@"String" sender:indexPath]; 

并在 segue 中添加了一个 if 语句并解决了问题。

于 2013-08-22T07:05:41.220 回答