简体   繁体   English

UIView 落后于另一台 UIView iPad/iPhone

[英]UIView gets behind another UIView iPad/iPhone

I have the root View which is the default view that comes in with the nib file.我有根视图,它是 nib 文件附带的默认视图。 In that view I have a Image for the background and two other views:在那个视图中,我有一个背景图像和另外两个视图:

在此处输入图像描述

and in the simulator the ViewMain contains: (I made the alpha of the other view = 0 to show that view)并且在模拟器中 ViewMain 包含:(我将另一个视图的 alpha = 0 以显示该视图)

在此处输入图像描述

and when I make the alpha of the ViewValor1 = 1 I get:当我制作 ViewValor1 = 1 的 alpha 时,我得到:

在此处输入图像描述

this view contains a page but everything else is still on the background.此视图包含一个页面,但其他所有内容仍在后台。

WHY IS IT THAT SOMETIMES THE VIEWMAIN GET SEND TO THE TOP???为什么有时 ViewMAIN 会被发送到顶部???

在此处输入图像描述

How can I prevent that from happening?我怎样才能防止这种情况发生? I have noticed that that happens only when I rotate the device first several times and then change the alpha of ViewValor1.我注意到只有当我先旋转设备几次然后更改 ViewValor1 的 alpha 时才会发生这种情况。 Maybe I should set that view to be on the top before making it's alpha equal to 1. how can I do that?也许我应该将该视图设置为顶部,然后使其 alpha 等于 1。我该怎么做?

Whenever there is refresh in the view, move that background view to background by [viewMain sendSubviewToBack:viewValor];每当视图中有刷新时,通过[viewMain sendSubviewToBack:viewValor];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM