开发者

Subview behaves strangely in navigation-based app

开发者 https://www.devze.com 2023-04-09 07:16 出处:网络
I\'m currently developing an app for iphone (my first) and I used several UITableViewController for navigation.

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 开发者_如何学JAVAmoves 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号