我想推下一个控制器,但不成功。我该怎么办?
-(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) {
}
}
答案 0 :(得分:0)
你必须为viewcontroller设置标识符并调用类似
的方法 CallViewController *vc=[self.storyboard instantiateViewControllerWithIdentifier:@"CallViewController"];
[self.navigationController pushViewController:vc animated:YES];
并确保您已嵌入导航视图控制器。