Search code examples
iosspotifyfacebook-logincocoalibspotify-2.0libspotify

On ios7, Spotify Login with Facebook View shown below Navigation Item


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


Solution

  • 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).