2015-10-13 49 views
0

我想推动下一个控制器,但不成功,我该怎么办?collectionView,didSelectItemAtIndexPath一些问题

-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath 
{ 
    UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath]; 

    NSInteger section = indexPath.section, row = indexPath.row; 

if (section == 1) { 

     if (row == 0) { 

      DetailsViewController * DetailsVC = [DetailsViewController alloc]init]; 

      [self.navigationController pushViewController: DetailsVC animated:YES]; 
     } else if (row == 1) { 
       } 
    } else if 
(section == 2) { 

    } 

} 

enter image description here

回答

0

你必须为视图控制器设置标识符和调用方法类似

CallViewController *vc=[self.storyboard instantiateViewControllerWithIdentifier:@"CallViewController"]; 

[self.navigationController pushViewController:vc animated:YES]; 

,并确保您嵌入了导航视图控制器。

+0

感谢您的帮助。 – runsheng0324