子视图在基于导航的应用程序中表现奇怪
我目前正在开发一个 iPhone 应用程序(我的第一个),我使用了几个 UITableViewController
进行导航。
然后,我使用附加到 self.view.superview 的子视图来获取顶部的非滚动图像。 子视图是在IB中创建的,简单的UIView
,其中有一个UIImageView
。
我在 viewDidAppear 中添加子视图,并且功能良好。 但是,一旦我点击一个单元格并且导航控制器推送下一个动画视图,前一个视图(滚动到视线之外)就会变成完全白色,并且我的子视图将动画移动到中心。它只持续了半秒左右,因为随后由于下一个视图的到来而消失了,但这确实令人不安。
我尝试删除 viewWillDisappear
中的子视图,从而删除 UIImageView
,但屏幕仍然变成全白。
有人如何解决这个问题吗?
哦,还有 PS:我只在模拟器上工作,因为我还没有开发者帐户。我无法将所有内容都更改为 ViewController,因为我有一个截止日期。
I'm currently developing an app for iphone (my first) and I used several UITableViewController
for navigation.
I then used a subview attached to self.view.superview
to get a non-scroll image at the top.
The subview is created in IB, simple UIView
with an UIImageView
in it.
I'm adding the subview in viewDidAppear
and this functions well.
But as soon as I'm tapping a cell and the navigationController pushes the next View animated, the previous view (scrolling out of sight) becomes completely white and my subview moves animated to the center. It's only for a half second or so, because then it's gone due to the next view arriving, but it's really unnerving.
I tried removing the subview in viewWillDisappear
, that removes the UIImageView
, but the screen still becomes completely white.
Does anybody how to fix this?
Oh, and PS: I'm working only on the Simulator, because I have no Developer Account yet. And I cannot change everything to a ViewController because I have a deadline to meet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您弄乱不属于您的视图控制器的视图时,如果出现问题,您不应该感到惊讶。您不应使用表视图控制器,而应将其替换为自定义 UIViewController,其视图充当表视图及其上方的非滚动视图的容器视图。
You shouldn't be surprised that things go wrong when you mess with the views of view controllers that don't belong to you. Rather than using a table view controller, you should replace it with a custom
UIViewController
whose view acts as a container view for both the table view and the non-scrolling view above it.