堆栈上的透明视图
我正在尝试找出我的可能性。我有一个带有公开按钮的 TableCellView。当前,当您点击公开按钮时,视图控制器会通过选择器推送到堆栈上。这是一些图像。
TextField 旁边的公开按钮
在 IB 中,选择器后面的视图的 alpha 设置为 0.5,不透明设置为 NO。
我天真地认为这会表明我的观点如下。
在模拟器中,我不仅看不到下面这个视图,
但我的选择器受到其背后透明视图的影响。
要点
所以我想我的问题是我可以做我在这里尝试的事情并显示表格视图,其中详细信息视图下方的披露按钮呈灰色。如果没有,是否有另一种方法不像 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.
the disclosure button next to a TextField
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.
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
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.
不要推送新的视图控制器(隐藏前一个视图),而是使用模态视图控制器,并且不要将视图的 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.