为什么来自AppDelegate和台风的行为有所不同?

时间:2015-06-14 16:07:56

标签: ios objective-c typhoon

我想将状态栏的样式设置为:

 [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;

如果我直接从AppDelegate这样做 - 一切都好,但是通过Typhoon - 不是。

1)工作正常:

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

2)那不起作用:

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

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

第二种方式我使用台风:

@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

在这两种情况下我都使用相同的高级版样式,其中有一个:

[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;

1 个答案:

答案 0 :(得分:2)

我认为这是因为Typhoon在#include<iostream> #include<set> typedef std::set<int>::iterator it; std::set<int> set_int; int main() { set_int.insert(1); it i = set_int.begin(); *i = 11; //error: assignment of read-only location } 之前开始初始化。

我建议避免依赖# Prepare Data mydata <- read.csv("~/student-mat.csv", sep=";") # Let's only grab the numeric columns mydata <- mydata[,c("age","Medu","Fedu","traveltime","studytime","failures","fam mydata <- na.omit(mydata) # listwise deletion of missing mydata <- scale(mydata) # standardize variables ibrary(ggplot2) # K-Means Clustering with 5 clusters fit <- kmeans(mydata, 5) #to change number of clusters, I change the "5" # Cluster Plot against 1st 2 principal components # vary parameters for most readable graph library(cluster) clusplot(mydata, fit$cluster, color=TRUE, shade=TRUE, labels=0, lines=0) 初始化顺序,并在调用didFinishLaunchingWithOptions方法(第一种方式)之后显式进行任何UI设置