重新定向后 UIview 大小出现问题

发布于 2024-10-02 15:34:19 字数 389 浏览 0 评论 0原文

首先,我很抱歉我的英语不好......

所以,我对添加到另一个视图上的视图有疑问。 我将 IB 中 UIview 的大小设置为 200px/200px 我将此视图的中心设置为父视图的中心。 此时一切都进展顺利。 我可以像我想要的那样在父视图的中心看到我的视图。

然后我设置 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 这正在发挥作用。

但是当我旋转 iPhone 时,视图的大小变为全尺寸,视图不想保持在中心位置并位于屏幕的左上角并调整为全屏......

有人可以帮我解决这个问题吗? 旋转后是否必须设置框架和中心?那不能是自动的吗?

谢谢你!

First,I am sorry for my poor english...

So, i have a problem with a view which is added on a other one.
I am setting size of UIview in IB as 200px/200px
I set the center of this view with the center of parent view.
Everything is working great at this point.
I can see my View in the center of the parent view like i want.

Then I set the - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
And that's working to.

But when i rotate the iphone, the size of the view change to full size, the view don't want to stay in center and go on the top left of the screen and resize as fullscreen...

Can somebody help me with this problem ?
Do I have to set the frame and the center after rotate ? That can't be automatic ?

Thank you!

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

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

发布评论

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

评论(1

梦里°也失望 2024-10-09 15:34:19

在 IB 中的“自动调整大小”部分下,删除指示组件自动宽度/高度的“箭头”。

In IB, under the "Autosizing" section, remove the "arrow" that indicates auto width/height of your component.

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