collectionView, didSelectItemAtIndexPath 一些问题
collectionView, didSelectItemAtIndexPath some issue
我想推送下一个控制器,但是unsuccess.what我应该这样做吗?
-(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) {
}
}
您必须为 viewcontroller 设置标识符并调用方法
CallViewController *vc=[self.storyboard instantiateViewControllerWithIdentifier:@"CallViewController"];
[self.navigationController pushViewController:vc animated:YES];
并确保您已嵌入导航视图控制器。
我想推送下一个控制器,但是unsuccess.what我应该这样做吗?
-(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) {
}
}
您必须为 viewcontroller 设置标识符并调用方法
CallViewController *vc=[self.storyboard instantiateViewControllerWithIdentifier:@"CallViewController"];
[self.navigationController pushViewController:vc animated:YES];
并确保您已嵌入导航视图控制器。