首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法从UICollectionReusableView中分离

无法从UICollectionReusableView中分离
EN

Stack Overflow用户
提问于 2013-12-18 16:30:51
回答 1查看 311关注 0票数 0

我有UICollectionView和Header.I,我有textfield和image.I,我尝试过推送工作fine.But,我需要调用segue!任何帮助都将不胜感激。

Header.h

代码语言:javascript
复制
@interface HeaderRV : UICollectionReusableView
@property (weak, nonatomic) IBOutlet UITextField *searchField;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
- (IBAction)backButton:(id)sender;


@end

Header.m

代码语言:javascript
复制
@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
EN

回答 1

Stack Overflow用户

发布于 2014-08-31 07:09:10

我和你有同样的问题。这实际上相当棘手,因为您可以在一个空项目中完美地完成“在collectionHeaderView中执行segue”(我尝试过)。我发现这个问题的关键是,您的导航控制器的RootVC不是应用程序的初始VC。

您可以通过在您的.m文件中添加显示导航控制器的rootVC的以下行来解决这一问题。

代码语言:javascript
复制
- (IBAction)next:(id)sender {
[theRootVCinNavigationController] *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"[your identifier]"];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:[theRootVCinNavigationController]];
[self presentViewController:navigationController animated:YES completion:nil];
}

参考文献:

  1. How to add an UINavigationController to an UIViewController presented as Modal

  1. https://developer.apple.com/Library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/NavigationControllers.html (搜索“创建导航界面”)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20663420

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档