Re: viewWillAppear not called with UINavigationController containment
Re: viewWillAppear not called with UINavigationController containment
- Subject: Re: viewWillAppear not called with UINavigationController containment
- From: Roland King <email@hidden>
- Date: Thu, 29 Dec 2011 09:49:43 +0800
Yes .. mine!
So I found that it's almost impossible NOT to get viewWillAppear and all the other messages in perfect order for every view every single time. As long as you call addChildViewController and didMoveToParent (either bracketing the add of the VC's view or not, depending on whether you are actually adding the subview at that time or deferring it to later as you would with say a tabviewcontroller type container) and the reverse, you get the calls. The only way I could find NOT to get them is to mess about adding and removing subviews in layoutSubviews of the custom container view controller's view. If you do that you lose messages and get messages doubled up, but nobody in their right mind would mess with the subview hierarchy in layoutSubviews right .. except me to save duplicating 4 lines of code.
Easy fix when found, stupid piece of code to have written in the first place. I smelled it when I wrote it and did it anyway, price paid, lesson learned. So I think I can say that view controller containment, at least that piece of it, works as it says on the tin and forwards messages beautifully to each of the contained controllers and views.
On Dec 29, 2011, at 1:41 AM, Matt Neuburg wrote:
> On Wed, 28 Dec 2011 08:05:58 +0800, Roland King <email@hidden> said:
>
>> I'll go put it back the way it was and see if there's something else I missed. The whole thing is being triggered in a viewdidload method, wonder if that's too early because the container VC doesn't have an on screen view. Trying to think what would be different in a popover.
>>
>
> I'll try to do some testing too - it's perfectly possible that you've discovered a bug. m.
>
> --
> matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
> A fool + a tool + an autorelease pool = cool!
> Programming iOS 4!
> http://www.apeth.net/matt/default.html#iosbook
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden