UIImagePickerControllerSourceTypePhotoLibrary 状态栏纯色/白色

发布于 2024-11-28 16:59:32 字数 944 浏览 6 评论 0原文

我正在创建一个应用程序,在某种程度上打开照片库。问题是状态栏在照片库中是黑色透明的,而我想要一个默认的应用程序(纯白色)。有什么办法可以改变吗。。

我想补充一点,我尝试对此:iOS SDK - 使用 UIImagePickerController 时如何恢复状态栏? 方法:

-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[[UIApplication sharedApplication] setStatusBarHidden:NO];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES];
}

仅适用于我的相机,不适用于照片库。当然我也尝试过默认样式。

更新:我找到了一种更改导航栏的方法:

- (void)navigationController:(UINavigationController *)navigationController 
   willShowViewController:(UIViewController *)viewController
                 animated:(BOOL)animated {
navigationController.navigationBar.barStyle = UIBarStyleDefault;
}

这个可以工作,但是状态栏样式仍然是黑色的,而我需要默认的应用程序,所以是白色的。

非常感谢!

I'm creating an app, that is in some point turning photo library on. The problem is that status bar is black transparent in photo library while i want a default application one (solid white). Is there any way to change it..?

I would add, that i tried regarding to this: iOS SDK - How to get the status bar back when using UIImagePickerController? method:

-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[[UIApplication sharedApplication] setStatusBarHidden:NO];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES];
}

works only for camera for me, not photo library. Of course i tried with default style too.

UPDATE: i found out a way to change navigation bar:

- (void)navigationController:(UINavigationController *)navigationController 
   willShowViewController:(UIViewController *)viewController
                 animated:(BOOL)animated {
navigationController.navigationBar.barStyle = UIBarStyleDefault;
}

This one works, however status bar style is still dark, while i need the default application one, so white.

Many thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

£烟消云散 2024-12-05 16:59:32

以不同的方式解决了我的问题。为了保持状态栏始终相同,我刚刚添加了 viewDidAppear 方法,该方法写在我的 rootViewController 的主帖子中,所以它始终是相同的,包括打开照片库

Fixed my problem in a different way. To keep the status bar always the same i just added viewDidAppear method, that is written in my main post to my rootViewController, so it is same all the time including turning photo library on

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文