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 .
Unchecking "Use Size Classes" option and then coming back and re-checking it again fixes this issue.
The solution with the size classes is weird to me, because I do not experience any issues for now by adding a subview into the window on iOS 9.
Also i want to point that when the rootViewController is set - all existing views in the window's hierarchy are removed.
From UIWindow documentation:
The root view controller provides the content view of the window. Assigning a view controller to this property (either programmatically or using Interface Builder) installs the view controller’s view as the content view of the window. If the window has an existing view hierarchy, the old views are removed before the new ones are installed.
So you have to make sure that you add your view into the window hierarchy after the rootViewController is set.
For example when the first controller is loaded - you can lazy load that view only once.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With