Search code examples
iosxcodeios9uiwindow

UIWindow addSubview is not working in ios 9


following code working fine in ios 8 ,But in ios 9 i am getting white page with no content.

MRForceUpdateView * mForceUpdateView = [[[NSBundle mainBundle] loadNibNamed:@"MRForceUpdateView" owner:self options:nil] objectAtIndex:0];

mForceUpdateView.frame = self.view.frame;

UIWindow * window = [[[UIApplication sharedApplication] delegate] window];

[window addSubview:mForceUpdateView];

please suggest a method to add a custom view on app level .

thanks in advance .


Solution

  • Unchecking "Use Size Classes" option and then coming back and re-checking it again fixes this issue.

    • In the project navigator, select a storyboard or xib file.
    • The file’s contents open in Interface Builder.
    • Choose View > Utilities > Show File Inspector.
    • In the Interface Builder Document section, un-tick the "Use Size Classes" checkbox.
    • Leave the menu. Come back and tick the "Use Size Classes" checkbox again.