質問

So, I have this problem, basically the view controller appears below the navigation controller. This happens a lot in iOS 7, however, in this case I haven't been able to fix it with just self.edgesForExtendedLayout = UIRectEdgeNone, because I don't know for which view controller I should set this.

How could I solve this?

Thanks.

enter image description here

役に立ちましたか?

解決

Solved it. Create a viewWillAppear method in SPLoginViewController.m like so:

- (void)viewWillAppear:(BOOL)animated {
        [super viewWillAppear:animated];

        UIViewController *internalLoginViewController = [[self viewControllers] objectAtIndex:0];
        if (internalLoginViewController && [internalLoginViewController respondsToSelector:@selector(edgesForExtendedLayout)])
        {
            [internalLoginViewController setEdgesForExtendedLayout:UIRectEdgeNone];
        }
}

Apparently the view controller we want to target is the one at index 0 in the UINavigationController's view controllers (SPLoginViewController is a UINavigationController).

他のヒント

By unchecking this in the viewcontroller property enter image description here

just uncheck the Adjust Scroll View Insets and it will work fine.

Update: Use this if you are not using xib/storyboard

self.edgesForExtendedLayout=UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars=NO;
self.automaticallyAdjustsScrollViewInsets=NO;
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top