当前位置:编程学习 > wap >>

UIView嵌套问题



我在UIView上摆放一个UIView,上面的UiView完全覆盖下面的UIView,而且两个UIView都存在相应的UIViewController,然后问题来了。 

1,首次进界面后,页面位置不准,嵌套的UIView总是偏上一点,并没有对齐。屏幕旋转过以后位置就准确了。 

2,嵌套的UIView事件都不生效,如何才能让嵌套的UIView对应的UIViewController的事件(如shouldAutorate)生效? 现在我只能在顶层的UIView上调用底层的。

希望高手能告诉我解决方法和原因。 

万分感谢!! 

高手如果能提供讲解的链接也万分感谢。
--------------------编程问答-------------------- 是点电池条导致没对齐的吧
是viewwillappear失效吗
http://blog.csdn.net/ArthurChenJS/archive/2011/04/24/6358614.aspx --------------------编程问答-------------------- 截了几个图 

这是刚进去时的样子,下面有空白 



这是旋转以后的样子,没问题了。 

 

旋转一圈回到原位,也是好的。 

 

我是一个UIView套一个UIView,再套一个UIImageView。 

动态调整的页面,代码如下,currentView就是嵌套的View。 
              if ((interfaceOrientation == UIDeviceOrientationPortrait) 
                     ||(interfaceOrientation == UIDeviceOrientationPortraitUpsideDown)) { 
                     self.view.bounds= CGRectMake(0.0f, 0.0f, 768.0f, 1024.0f); 
                     self.view.frame= CGRectMake(0.0f, 0.0f, 768.0f, 1024.0f); 
                     currentView.frame= CGRectMake(0.0f, 0.0f, 768.0f, 1024.0f); 
              } 
              if ((interfaceOrientation == UIDeviceOrientationLandscapeRight) 
                     ||(interfaceOrientation == UIDeviceOrientationLandscapeLeft)) { 
                     self.view.bounds= CGRectMake(0.0f, 0.0f, 1024.0f, 768.0f); 
                     self.view.frame= CGRectMake(0.0f, 0.0f, 1024.0f, 768.0f); 
                     currentView.frame= CGRectMake(0.0f, 0.0f, 1024.0f, 768.0f); 
              } 
              return [currentViewController setViewControllersFrame:interfaceOrientation]; 


电池条也被我隐藏了。
--------------------编程问答-------------------- --------------------编程问答-------------------- --------------------编程问答-------------------- 楼主是要上面的UIView接收到响应,然后下面的UIView真正响应吗?
补充:移动开发 ,  iPhone
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,