2015-05-21 43 views

回答

3

你需要創建一個視圖控制器塞格斯其中包含收集視圖(非單元格)到目標視圖控制器,例如:

UICollectionViewController -> UIViewController1 
UICollectionViewController -> UIViewController2 
//...etc 

記得爲每個賽段添加標識符。

並在代碼重寫UICollectionViewDelegate方法

collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) 

哪個小區被竊聽(indexPath)該方法檢查中,如果這是小區1呼叫賽格瑞用正確的標識符:

performSegueWithIdentifier("goToVC1Identifier", sender: nil) 
2

就做編程,像這樣在UICollectionViewDelegate方法didSelectItemAtIndexPath

UIViewController *c = [self.storyboard instantiateViewControllerWithIdentifier:[NSString stringWithFormat:@"%li",(long)indexPath.row]]; 

[self.navigationController pushViewController:c animated:YES]; 
//or however you a moving to next viewcontroller 

確保您viewcontrollers有正確命名的標識符相匹配的細胞

1

你會需要在collectionview的代理的- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath中手動執行segue。

相關問題