横向操作表中的 UIPickerView

发布于 2024-11-30 18:19:43 字数 349 浏览 2 评论 0原文

我在 iPhone 应用程序的操作表中显示选择器视图;也就是说,我在视图中有一个按钮,它会触发一个包含选择器视图的操作表。它工作得很好,除非用户旋转设备。当用户以横向模式显示视图,然后触摸操作表的按钮时,选择器视图确实会出现,但它看起来是被抬起的。另一方面,当用户以纵向模式加载视图,然后触摸提示操作表的按钮时,看起来不错。对于这里可能发生的事情有什么想法吗? 这是用户从已处于横向模式的视图中打开操作表的时间

这是用户以纵向打开视图,然后将设备切换为横向时的外观

I display a picker view in an actionsheet in my iPhone app; that is, I have a button in a view which triggers an actionsheet that holds a picker view. It works great, except when the user rotates the device. When the user displays the view in landscape mode and then touches the button for the actionsheet, the pickerview does appear, but it looks jacked up. On the other hand, when the user loads the view in portrait mode and then touches the button which prompts the actionsheet, it looks ok. Any thoughts as to what might be going on here?
This is when the user opens the actionsheet from a view that's already in landscape mode

This is how it looks when the user opens the view in portrait, and then turns the device to landscape

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

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

发布评论

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

评论(1

浅暮の光 2024-12-07 18:19:43

确保配置操作表的边界和选取器视图的框架以适合您使用的方向。

我对风景使用以下设置:

[self.sheet setBounds:CGRectMake(0, 0, 480, 400)];
CGRect pickerFrame = CGRectMake(0, 40, 480, 180);
closeButton.frame = CGRectMake(420, 7.0f, 50.0f, 30.0f);

对肖像使用以下设置:

[sheet setBounds:CGRectMake(0, 0, 320, 500)];
CGRect pickerFrame = CGRectMake(0, 40, 0, 0);
closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);

祝你好运!

//濑户

Make sure you configure the bounds of the action sheet and the frame of the pickerview to suit the orientation you're using.

I'm using the following settings for landscape:

[self.sheet setBounds:CGRectMake(0, 0, 480, 400)];
CGRect pickerFrame = CGRectMake(0, 40, 480, 180);
closeButton.frame = CGRectMake(420, 7.0f, 50.0f, 30.0f);

And the following for portrait:

[sheet setBounds:CGRectMake(0, 0, 320, 500)];
CGRect pickerFrame = CGRectMake(0, 40, 0, 0);
closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);

Good luck!

//Seto

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