1
黒のステータスバーを白いテキストで表示したい。ビューコントローラがナビゲーションコントローラに組み込まれている場合は、私が使用 一般的なアプローチは、私がUINavigationControllerのステータスバーの背景をカスタマイズする
を行う光スタイルのステータスバーにカスタム黒のビューを作成するには、ビューコントローラCGFloat statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, statusBarHeight)];
view.backgroundColor = [UIColor blackColor];
[self.view addSubview:view];
の一番上に追加する必要があります
CGFloat statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, -statusBarHeight, [UIScreen mainScreen].bounds.size.width, statusBarHeight)];
view.backgroundColor = [UIColor blackColor];
[self.navigationController.navigationBar addSubview:view];
これは非常にエレガントな解決策ではないようですが、おそらくもっと良いアプローチがありますか?