当我在全屏应用程序中关闭 UIImagePicker 时,状态栏会显示并将所有内容向下移动 20px

发布于 2024-12-28 07:39:28 字数 153 浏览 2 评论 0原文

我在全屏应用程序中设置了 UIImagePickerViewController(状态栏最初隐藏)。但是,当在模拟器上进行测试时,状态栏会在 modalViewController 关闭时显示。有什么问题吗?

任何帮助表示赞赏!

塞布

I have set-up a UIImagePickerViewController in a full screen app (Status bar initially hidden). But when it comes to testing it on the simulator, the status bar shows when the modalViewController is dismissed. What's the problem?

Any help appreciated!

Seb

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

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

发布评论

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

评论(2

冬天旳寂寞 2025-01-04 07:39:28

请查看 http://vickiwenderlich.s3-website-us-east-1.amazonaws.com/wp-content/uploads/2011/07/Basic_iOS_Stats_iPhone.jpg

状态栏高 20 像素。

iPhone屏幕分辨率是宽度=320,高度480,当它是视网膜显示屏时,它是640 x 960。如果你以低分辨率拍摄照片,你会看到它是720x960。在相机胶卷中,您的图像实际上被裁剪了。

你可以尝试调整图像的大小,这确实不容易。

您可以尝试关闭状态栏。

[[UIApplication sharedApplication] setStatusBarHidden:YES];

Please look at the image on http://vickiwenderlich.s3-website-us-east-1.amazonaws.com/wp-content/uploads/2011/07/Basic_iOS_Stats_iPhone.jpg

Status bar is 20 pixels high.

iPhone screen resolution is width=320 and height 480, and when it is retina display it is 640 by 960. If you take a photo in the low resolution, you will see that it is 720x960. In the camera roll, the image you is actually cropped.

You can try to resize the image which is really not easy.

You can try to dismiss the status bar.

[[UIApplication sharedApplication] setStatusBarHidden:YES];
深陷 2025-01-04 07:39:28

我已经发布了一个解决方案,它是关于 UIKit 中的错误的建议。我也发现过同样的情况,并发现了不良行为发生的关键时刻。

要复制该错误,首先需要使用presentModalViewController呈现一个UIImagePicker控制器,并且图像选择器具有sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum。
它还有助于直观地看到错误,在呈现之前调整 UIImagePicker 视图的框架,以便您可以看到屏幕的顶部。

然后在您的调用中放置一个断点解雇ViewControllerAnimated:completion:或解雇ModalViewControllerAnimated:并跳过它,观察状态栏立即绘制(假设您的UIImagePicker不是全屏,在全屏应用程序中)并检查[[UIApplication sharedApplication] isStatusBarHidden ] 之前和之后。

它会更改状态,但如果使用 sourceType = ..Camera 或 ...PhotoLibrary,则不会更改。

所以我建议使用 PhotoLibrary 而不是 ...SavedPhotosAlbum。

I've posted a solution to this, it's advice about a bug in UIKit. I've found the same situation and discovered the key moment when the bad behaviour happens.

To duplicate the bug, first you need to present a UIImagePicker controller using presentModalViewController, and the image picker has sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum.
It also helps, to visually see the bug, to adjust the frame of the UIImagePicker's view prior to presenting it, so you can see the top of the screen.

Then place a breakpoint on your call to dismissViewControllerAnimated:completion: or dismissModalViewControllerAnimated: and step over it, watch the statusbar get drawn instantly (assuming your UIImagePicker is NOT full screen, within your full-screen app) and check [[UIApplication sharedApplication] isStatusBarHidden] before and after.

It changes state, but does not change if using sourceType = ..Camera or ...PhotoLibrary.

So I'd advise using PhotoLibrary instead of ...SavedPhotosAlbum.

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