堆栈上的透明视图

发布于 2024-11-15 06:22:51 字数 543 浏览 7 评论 0原文

我正在尝试找出我的可能性。我有一个带有公开按钮的 TableCellView。当前,当您点击公开按钮时,视图控制器会通过选择器推送到堆栈上。这是一些图像。

bar
TextField 旁边的公开按钮

ib
在 IB 中,选择器后面的视图的 alpha 设置为 0.5,不透明设置为 NO。
我天真地认为这会表明我的观点如下。

acctual
在模拟器中,我不仅看不到下面这个视图,
但我的选择器受到其背后透明视图的影响。

要点
所以我想我的问题是我可以做我在这里尝试的事情并显示表格视图,其中详细信息视图下方的披露按钮呈灰色。如果没有,是否有另一种方法不像 UIAlertView 那么无聊,或者像只显示选择器一样简单。

I am trying to figure out my possibilities. I have a TableCellView with a disclosure button. When you hit the the disclosure button currently a viewcontroller is pushed on the stack with a picker. Here are some images.

bar
the disclosure button next to a TextField

ib
In IB, the view behind the picker has alpha set to 0.5 and opaque set to NO.
I naively thought this would show my view below.

acctual
In the simulator, not only do i not see my view below this one,
but my picker is affected by the transparent view behind it.

The Point
So I suppose my question is can I do what I am trying here and display the tableview with the disclosure button below the detail view, grayed out. If not, is there another approach not as boring as a UIAlertView or plain as showing just a picker.

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

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

发布评论

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

评论(2

混吃等死 2024-11-22 06:22:51

UIViewController 的视图应该是不透明的并填充其窗口。因此,您无法像尝试那样堆叠它们,因为您希望在后台看到的视图不会被绘制并且可能已完全卸载。

如果您想像这样对视图进行分层,则必须将透明视图添加为 UIViewController 视图的子视图,而不是推送新的视图控制器。

UIViewController's views are expected to be opaque and fill their window. As a result you cannot stack them as you are attempting to do because the view you expect to see in the background will not be drawn and may have been unloaded entirely.

If you want to layer views like that you are going to have to add your transparent view as a subview of your UIViewController's view instead of pushing a new view controller.

謸气贵蔟 2024-11-22 06:22:51

不要推送新的视图控制器(隐藏前一个视图),而是使用模态视图控制器,并且不要将视图的 alpha 设置为 0.5,而是将其背景颜色设置为 alpha 为 0.5 的颜色,以便选取器的不透明度不受影响。

Instead of pushing a new view controller (which hides the previous view), use a modal view controller, and instead of setting the view's alpha to .5, set it's background color to a color with an alpha of .5, so the picker's opacity isn't affected.

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