gpt4 book ai didi

iphone - UIImagePickerController PresentViewController - ios7 中的状态栏问题

转载 作者:行者123 更新时间:2023-12-03 19:10:16 27 4
gpt4 key购买 nike

我在 iOS 7 中遇到状态栏问题。 enter image description here

下面是展示此图像选择器的代码

if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {

picker.sourceType =UIImagePickerControllerSourceTypePhotoLibrary;

if ([self respondsToSelector:@selector(presentViewController:animated:completion:)]){
[self presentViewController:picker animated:YES completion:^{

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
[[UIApplication sharedApplication] setStatusBarHidden:YES
withAnimation:UIStatusBarAnimationNone];
}];
}
else {
[self presentModalViewController:picker animated:YES];
}
}

当我尝试选择图像时,屏幕如下所示

enter image description here

谁能帮我解决这个问题吗?

最佳答案

试试这个

- (void)imagePickerController:(UIImagePickerController *)aPicker didFinishPickingMediaWithInfo:(NSDictionary *)info {

// for iOS7
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {

[[UIApplication sharedApplication] setStatusBarHidden:YES];
}

编辑:

这是一个更简单的解决方案。

在 plist 中添加基于 bool View Controller 的状态栏外观,并将其值设置为 NO。然后在您的应用程序委托(delegate) application didFinishLaunchingWithOptions 中声明以下内容:

[application setStatusBarHidden:NO];
[application setStatusBarStyle:UIStatusBarStyleDefault];

当您启动相机时,它应该处理状态栏。然后对于相机胶卷部分,只需在已放置 UIImagePickerController 代码的 View Controller 中添加以下方法即可

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}

当您选择相机胶卷时,它应该处理模态视图状态栏。

希望这对大家有帮助。

关于iphone - UIImagePickerController PresentViewController - ios7 中的状态栏问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19319484/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com