0
我有一個視圖控制器,顯示兩個集合視圖。我現在想從兩個集合視圖繼續到不同的目標控制器。我有下面的代碼,但沒有運氣。在1個視圖控制器上的兩個單獨的集合視圖之間的爭論
- (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;
}
給兩個segues不同的標識符。然後你可以使用if語句來檢查它們。或者您可以在segue的destinationViewController上使用'isMemberOfClass'來檢查正在執行哪個segue。 – s1m0n
[self performSegueWithIdentifier:@「String」sender:indexPath]; segue標識符像一個魅力工作 –