1. 程式人生 > >網格進行跳轉

網格進行跳轉

//點選網格進行跳轉
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    if(indexPath.row==0){
        NSLog(@"點選了1!");
        t1ViewController *t1=[t1ViewController new];
        [self presentViewController:t1 animated:YES completion:nil];
    }else if(indexPath.row==1){
        t2ViewController *t2=[t2ViewController new];
        [self presentViewController:t2 animated:YES completion:nil];
    }else{
        t3ViewController *t3=[t3ViewController new];
        [self presentViewController:t3 animated:YES completion:nil];
    }
}