相关疑难解决方法(0)

嵌入自定义容器视图控制器时,内容位于导航栏下方.

UPDATE

根据Tim的回答,我在每个视图控制器中实现了以下内容,该控制器具有作为自定义容器一部分的scrollview(或子类):

- (void)didMoveToParentViewController:(UIViewController *)parent
{
    if (parent) {
        CGFloat top = parent.topLayoutGuide.length;
        CGFloat bottom = parent.bottomLayoutGuide.length;

        // this is the most important part here, because the first view controller added 
        // never had the layout issue, it was always the second. if we applied these
        // edge insets to the first view controller, then it would lay out incorrectly.
        // first detect if it's laid out correctly with the following condition, and if
        // not, manually make the adjustments …
Run Code Online (Sandbox Code Playgroud)

objective-c uinavigationbar ios ios7

55
推荐指数
3
解决办法
1万
查看次数

iOS 7表视图无法自动调整内容插入

我正在将我的项目转移到iOS7.我正面临着与半透明导航栏相关的奇怪问题.

我有一个视图控制器,它有一个tableview作为子视图(让我们称之为ControllerA).我使用controllerA初始化一个新的uinavigationcontroller并使用presentviewcontroller以模态方式呈现它.导航栏会阻止显示的视图控制器的表视图.我将automaticAdjustsScrollViewInsets设置为YES,但结果没有改变.我知道我可以将edgesForExtendedLayout设置为UIRectEdgeNone,但它会使导航栏不再是半透明的.

表视图被阻止

之后,我尝试创建一个新的视图控制器进行测试.它包含几乎相同的元素.但结果却大相径庭.表视图内容不会被阻止.

在此输入图像描述

结论

  1. 两个View Controllers的automaticAdjustsScrollViewInsets设置为YES
  2. 该项目不使用故事板
  3. 第一个是在Xcode 4.6上创建的,第二个是在Xcode 5上新创建的
  4. 我比较了两个类xib和代码,没有太大的不同

iphone objective-c uitableview ios7

38
推荐指数
2
解决办法
4万
查看次数

标签 统计

ios7 ×2

objective-c ×2

ios ×1

iphone ×1

uinavigationbar ×1

uitableview ×1