On dirait iOS bug.
Je ne sais pas une belle façon de contourner cela, mais ces œuvres certainement:
utiliser l'API dépréciée
Changer d'entrée View controller-based status bar appearance
dans Info.plist à NO
. Ajouter un code comme celui-ci à tous de vos contrôleurs de vue (ou superclasse commune, espérons que vous avez un;)):
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[UIApplication sharedApplication] setStatusBarHidden:[self prefersStatusBarHidden]];
}
Utilisez tweak laid
par image mise à jour manuelle du système défaillant vue à l'origine de la condition. Cela peut ou peut ne pas casser quelque chose en dehors de l'application de test.
Dans UIViewController+TheTweak.h
#import <UIKit/UIKit.h>
@interface UIViewController (TheTweak)
- (void)transitionViewForceLayoutTweak;
@end
Dans UIViewController+TheTweak.m
(esprit le commentaire FIXME)
#import "UIViewController+TheTweak.h"
#import "UIView+TheTweak.h"
@implementation UIViewController (TheTweak)
- (void)transitionViewForceLayoutTweak {
UIViewController *presenting = [self presentingViewController];
if (([self presentedViewController] != nil) && ([self presentingViewController] != nil)) {
if ([self prefersStatusBarHidden]) {
NSUInteger howDeepDownTheStack = 0;
do {
++howDeepDownTheStack;
presenting = [presenting presentingViewController];
} while (presenting != nil);
//FIXME: replace with a reliable way to get window throughout whole app, without assuming it is the 'key' one. depends on your app's specifics
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
[window forceLayoutTransitionViewsToDepth:howDeepDownTheStack];
}
}
}
@end
Dans UIView+TheTweak.h
#import <UIKit/UIKit.h>
@interface UIView (TheTweak)
- (void)forceLayoutTransitionViewsToDepth:(NSUInteger)depth;
@end
En UIView+TheTweak.m
#import "UIView+TheTweak.h"
@implementation UIView (TheTweak)
- (void)forceLayoutTransitionViewsToDepth:(NSUInteger)depth {
if (depth > 0) { //just in case
for (UIView *childView in [self subviews]) {
if ([NSStringFromClass([childView class]) isEqualToString:@"UITransitionView"]) {
childView.frame = self.bounds;
if (depth > 1) {
[childView forceLayoutTransitionViewsToDepth:(depth - 1)];
}
}
}
}
}
@end
Maintenant, dans chaque contrôleur de vue (ou superclasse commune):
#import "UIViewController+TheTweak.h"
... // whatever goes here
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self transitionViewForceLayoutTweak];
}
Ou votre peut simplement tourner arrière-plan du contrôleur problématique noir :)
Dans SecondViewController dans buttonPush change nav.modalTransitionStyle = UIModalPresentationPopover; à nav.modalPresentationStyle = UIModalPresentationOverCurrentContext; – beyowulf
Toujours en train de voir la barre noire - avez-vous testé avec la barre d'état étendue active? – Cbas
Oui, j'ai testé sur appareil et en simulateur (commande + Y). – beyowulf