【问题标题】:Q:I got an issue with navigationController pushQ:navigationController push 出现问题
【发布时间】:2016-06-21 11:36:00
【问题描述】:

有人遇到这个问题吗? 当我从UIViewController 推送到情节提要基础viewController 并隐藏BottomBar 时,情节提要基础viewController 首先出现白色底部,情节提要基础viewController 的底部控件向下移动一下子,覆盖了白色的空白。有的朋友知道为什么会出现吗?以及如何解决这个问题?

代码在这里:

 InformationCollectionViewController *info = [self.sb instantiateViewControllerWithIdentifier:@"InformationCollectionViewController"];
 info.hidesBottomBarWhenPushed = YES;
 [self.navigationController pushViewController:info animated:YES];

顺便说一句:如果我设置[self.navigationController pushViewController:info animated:NO]; 不会显示那个问题。

【问题讨论】:

    标签: ios animation push uitabbar


    【解决方案1】:

    1.设置动画NO时,会显示最后的视图状态。
    2.如果您将一些视图布局到底部布局指南,您将在动画开始时看到底部栏。如果您布局到顶层视图,则不会出现此问题。

    【讨论】:

    • 你的回答是对的,但是,因为我使用自动布局来布局我的视图,有2个视图基于底部布局指南,我应该如何解决这个问题?
    • @LeoMaer 添加布局时,您可以选择要布局的位置。
    • 2 个视图的底部约束。
    【解决方案2】:

    我通过参考解决了这个问题:This link

    和参考有一些不同。 在info 控制器中:view 我要约束,只需更改底部约束。在Xcode 7 之前,解决方案可能是:constrain view.bottom to superview.bottom not bottomLayoutGuide in storyboard 但是在 Xcode7 之后,我的解决方案就奏效了。

    我的解决办法是:

    1.按Ctrl,将我要约束的view拖到左栏中info控制器的View,然后显示constraints picker

    2.然后我按ALT,显示另一个constraints,包含Bottom Space to Container Margin,现在你要做的就是选择它。

    3.然后你可以编辑Bottom Margin Alignment Constraint,确保

    第一项:Superview.Bottom Margin
    联系人:Equal 第二条:YourView.Top

    顺便说一句:Thx @Lumialxk,感谢您对这个问题的启发。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-05-26
      • 1970-01-01
      • 2021-09-01
      • 2011-08-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多