I have UICollectionView and Header.I have textfield and image.I did try push segue working fine.But I need to call segue! Any help will be appreciate
Header.h
@interface HeaderRV : UICollectionReusableView
@property (weak, nonatomic) IBOutlet UITextField *searchField;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
- (IBAction)backButton:(id)sender;
@end
Header.m
@implementation HeaderRV
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}
- (IBAction)backButton:(id)sender {
if ([self.searchField isEditing]) {
[self.searchField resignFirstResponder];
}
else{
//segue need to be here
}
}
@end
I had the same problem as you do. It's actually quite tricky because you can have done "perform segue in collectionHeaderView" perfectly in an empty project(I tried). I found the key to this problem is your RootVC of navigation controller isn't the initial VC of the app.
You can get around this by adding the lines below in your .m file that presents the rootVC of navigation controller.
References: