Why behaviour from AppDelegate and via typhoon is different?

157 views Asked by At

i want to set style for status bar to:

 [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;

if i'm doing it from AppDelegate directly - everything is ok, but via Typhoon - not.

1) That's working ok:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [[self styleKit] apply];
    [self.window makeKeyAndVisible];
    return YES;
}

2) And that's not working:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    return YES;
}

-(void)initialize {
    [[self styleKit] apply];
    [self.window makeKeyAndVisible];
}

at second way i use typhoon like:

@implementation LAMainAssembly
-(AppDelegate *)appDelegate {
    return [TyphoonDefinition withClass:[AppDelegate class] configuration:^(TyphoonDefinition *definition) {
        [definition injectProperty:@selector(window) with:[self mainWindow]];
        [definition injectProperty:@selector(styleKit)];
        [definition performAfterInjections:@selector(initialize)];
    }];
}
@end

in both cases i use same advanced version of styling, where there is a:

[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
1

There are 1 answers

2
Aleksey On BEST ANSWER

I think it's because Typhoon starts it's initialization before didFinishLaunchingWithOptions.

I would recommend to avoid dependency on Typhoon initialization order and do any UI setup explicit after didFinishLaunchingWithOptions method called (your first way)