if i understand your question completely, u want t launch a view controller from collection view cell, as a root view controller in that u can push and pop of other view controller
u can do like this,
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath: (NSIndexPath *)indexPath
{
LoginViewController *loginView = [[LoginViewController alloc]init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:loginController]; //add this as a root view controller
[self presentViewController:navController animated:YES completion:nil];
}
EDIT
define a custom delegate in your custom cell for example i took an example
CustomCollectionVIewCell
as my custom cell in CustomCollectionVIewCell.h
i defined a custom delegate as below
CustomCollectionVIewCell.h
#import <UIKit/UIKit.h>
@protocol CellFooterDelegate <NSObject>
- (void)cellFooterViewTapped; //this this is the custom delegate method
@end
@interface CustomCollectionVIewCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UIView *footerCellView;
@property (nonatomic, assign) id<CellFooterDelegate> myCustomdelegate;//define a delegate
@end
in CustomCollectionVIewCell.m
in this method u are getting the call to this method
- (void)profileTapped:(UITapGestureRecognizer *)gesture
{
//some code
if([_myCustomdelegate respondsToSelector:@selector(cellFooterViewTapped)])
{
[_myCustomdelegate cellFooterViewTapped]; //call the delegate method
}
NSLog(@"PROFILI %li",(long)gesture.view.tag);
}
in the view controller where u are using the collection view u do something like this
in confirmas to custom delegate like other delegates
ViewController.h
#import "CustomCollectionVIewCell.h" //import the file
@interface ViewController : UIViewController<UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout,CellFooterDelegate>//hear i am confirming to custom delegate
//.... other code
in ViewController.m
file
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
CustomCollectionVIewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
cell.myCustomdelegate = self; //important as u set self call back to this as u tap the cells footer view
//....other code
return cell;
}
//if delegate is set correctly u are getting call to this method
- (void)cellFooterViewTapped
{
//hear u can push the controller
NSLog(@"push hear");
}
rest of the code as it is no need to change,
hope this helps u .. :)
END EDIT