当关闭模态视图控制器时,底层 UIScrollView 调整大小为全屏

发布于 2025-01-05 17:51:48 字数 928 浏览 0 评论 0原文

我有一个布局,顶部有一个自定义状态栏[在Apple的状态栏下方],然后是一个在中间部分从左到右分页的UIScrollview,然后我有一个UIView 底部有一些自定义按钮。一个简单的三窗格布局,效果很好。但是,下部视图上的三个自定义按钮会弹出一个 ModalViewController,当它被关闭时,它会将中间的 UIScrollView 调整为全屏,并将其带到前面,涵盖了我的另外两个观点。

还有其他几个人注意到了这种行为,但似乎他们给出的唯一答案是将 UIScrollView 的大小重新调整回原始坐标。当然,这会起作用,但对我来说这似乎是一种黑客行为,我想知道这里幕后到底发生了什么,以及如何正确纠正问题。

其他具有相同明显问题的 SO 链接:

仍然其他人指出该行为仅影响 3.0 及更高版本,因此我不确定这是否是一个“功能”,而且我只是不明白该行为应该做什么或做什么。如果有人能对此有所了解,我将不胜感激。

I have a layout with a custom status bar on top [below Apple's status bar], then a UIScrollview that paginates left to right in the middle section, and then I have a UIView with some custom buttons on the bottom. So a simple three-paned layout, and it works great. However, the three custom buttons on the lower view bring up a ModalViewController, and when that is dismissed, it resizes the middle UIScrollView to full-screen, and brings it to the front, covering the other two views that I have.

There are several others who have noted this behavior, but it seems that the only answers they are given is to re-resize the UIScrollView back to the original coordinates. This will work, of course, but it seems like a hack to me, and I would like ot know what is really going on behind the scenes here, and how to rectify the issue correctly.

Other SO links with the same apparent issue:

Still others have noted that the behavior only affects 3.0 and up, so I am not sure if this is a "feature," and I am just not understanding what the behavior is supposed to be doing, or what. If anyone can shed some light on this, I would be grateful.

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

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

发布评论

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

评论(2

流年已逝 2025-01-12 17:51:48

我有完全相同的问题。
在模式视图的父级中,我使用这个

-(void)viewWillAppear:(BOOL)animated{
    [self.view setFrame:CGRectMake(0, 0, originalWidth, originalHeight)];
}

: OriginalHeight 是我的父视图的原始尺寸。

它工作得很好,即使这对我来说也像是一个黑客。

I have exactly the same problem.
In the parent of the modal view, I'm using this:

-(void)viewWillAppear:(BOOL)animated{
    [self.view setFrame:CGRectMake(0, 0, originalWidth, originalHeight)];
}

where originalWidth & originalHeight are the original sizes of my parent view.

it works fine, even if it sounds like a hack to me too.

莫多说 2025-01-12 17:51:48

您是否尝试过更改 nib 文件中的设置?

检查笔尖中滚动视图的自动调整大小。

Have you tried to change setting in nib files.?

Check the autosizing of scroll view in nib.

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