首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >iOS -在presentViewController之后,除了navigationBar什么都不能点击

iOS -在presentViewController之后,除了navigationBar什么都不能点击
EN

Stack Overflow用户
提问于 2017-04-27 11:28:39
回答 1查看 235关注 0票数 2

我尝试使用viewController(BrandViewController)从视图(MainCollectionViewCell.m)表示didselectItemAt方法。所以,

代码语言:javascript
运行
复制
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
        UIViewController *currentTopVC = [self currentTopViewController];
        BrandViewController *brandVC = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"BrandVC"];

        [currentTopVC presentViewController:brandVC animated:true completion:nil];
}

- (UIViewController *)currentTopViewController {
    UIViewController *topVC = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
    while (topVC.presentedViewController) {
        topVC = topVC.presentedViewController;
    }
    return topVC;
}

这段代码正确地显示了BrandViewController,但是除了我的back按钮之外,我不能单击来自BrandViewController的任何按钮或图像。你能给我一点关于这个问题的想法吗?

编辑:我有两个collectionViews。一个在MainViewController(MainCollectionView)中,另一个在MainCollectionViewCell(从这里调用的didSelectItemAt方法)中。

edited2:呈现视图层次结构有两个UITransitionView

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-04-27 12:10:58

尝试下面的代码:

代码语言:javascript
运行
复制
UINavigationController *currentTopVC = (UINavigationController *)[self currentTopViewController];
BrandViewController *brandVC = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"BrandVC"];
[currentTopVC pushViewController:brandVC animated:YES];
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43656500

复制
相关文章

相似问题

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