RSS feed

Nutsmuggling

viewWillAppear: not being called inside a UINavigationController

I just stumbled on a small problem that gave me a great headache. I changed the view hierarchy to implement flipping preferences on the back of my App’s main view. Accordingly, I had to move some stuff out of the nibs and into the code. Iin other words, some heavy refactoring, and without testing (I know, bad bad me).

So basically I now have a root UIViewController which has a UINavigationController as a subview; this, in turn, loads a number of UIViewControllers to navigate my items hierarchy.

Today, while working on cosmestic/usability improvements, I realised that something was definitely not working. When moving back and forth in my items, data were not refreshed. This pointed to one culprit, viewWillAppear not being called in the UIViewControllers.

After some googling I found out that if you add a UINavigationController as a subview of a UIViewController subclass, you must explicitly call its viewWillAppear method from its container; otherwise, they won’t be called, and when moving back and forth in the navigation tree, your UIViewControllers’ viewWillAppear: methods won’t be called.

It’s quite simple; assuming that projectNavigationController is a navigation controller added as a a subview of this UIViewController subclass, just make sure you add this simple call:

-(void)viewWillAppear:(BOOL)animated { 
	[super viewWillAppear:animated];
	[projectNavigationController viewWillAppear:animated];
}

Of course the same applies to your other viewWill/Did methods

-(void)viewWillDisappear:(BOOL)animated { 
	[super viewWillDisappear:animated];
	[projectNavigationController viewWillDisappear:animated];
}
-(void)viewDidAppear:(BOOL)animated { 
	[super viewDidAppear:animated];
	[projectNavigationController viewDidAppear:animated];
}
-(void)viewDidDisappear:(BOOL)animated { 
	[super viewDidDisappear:animated];
	[projectNavigationController viewDidDisappear:animated];
}

It’s quite simple, but wasn’t obvious for me at first.

Be Sociable, Share!

69 responses to “viewWillAppear: not being called inside a UINavigationController”

  1. Corina says:

    Generally I don’t read post on blogs, however I wish to say that this write-up very pressured me to take a look at and do so! Your writing taste has been surprised me. Thanks, very nice article.

    my web-site social media – Corina

  2. Bobbie says:

    Fabulous, what a web site it is! This blog provides useful data to us, keep it up.

    Here is my website :: work from home (Bobbie)

  3. Tammi says:

    It’s hard to find well-informed people in this particular topic, but you sound like you know what you’re talking about! Thanks

    my web-site … web development (Tammi)

  4. Violet says:

    That is really interesting, You’re an overly professional blogger. I have joined your rss feed and sit up for in search of more of your fantastic post. Additionally, I have shared your site in my social networks

    Here is my blog post – home based business (Violet)

  5. Everette says:

    Hello I am so grateful I found your site, I really found you by error, while I was looking on Bing for something else, Anyways I am here now and would just like to say kudos for a incredible post and a all round entertaining blog (I also love the theme/design), I don’t have time to read it all at the minute but I have saved it and also included your RSS feeds, so when I have time I will be back to read more, Please do keep up the great jo.

    Feel free to surf to my homepage – homepage (Everette)

  6. Keymnmayora says:

    [url=http://www.beyond6-sigma.com][b]uggs outlet store[/b][/url]this convert article I also watched a resource box before; He was great singer all around the foreigners’ eyes, they were crazy as well as him,but take heart that person didnot be popular throughout the his mother land; Don’t give up easily for going to be the dream,a resource box are shinning someday;[url=http://www.beyond6-sigma.com][b]cheap uggs outlet[/b][/url] [url=http://www.85ccc.info][b]uggs outlet[/b][/url]Film has been more and more people slightly like a resource box he or she can bring our way of life tremendous spiritual shock. Or depressed,or at least stimulus,or otherwise helpless, as about whether or not a number of us have also gone all over the their lives.[url=http://www.beyond6-sigma.com][b]uggs for kids[/b][/url] [url=http://www.85ccc.info][b]discount uggs[/b][/url]Spam can be really irritating.a number of us be able to get slightly like 300-400 dud comment messages a multi function day after we were featured on BBC last year :( We haven’t used turning off words of flattery after a certain period as all your family propose being very careful whilst Kristi ? I think that would certainly definitely be of assistance considering the fact that a lot of all of our spam seem to understand more about appear everywhere over the older posts.[url=http://www.85ccc.info][b]ugg outlet[/b][/url] [url=http://www.beyond6-sigma.com][b]cheap uggs outlet[/b][/url]Someone said that going to be the far better way for more information regarding how to lose some form of family member or friend is that to explore lend money; It sounds an all in one bit reasonalbe to most of these amplitude.[url=http://www.agiosgeorgiossilikou.org][b]uggs official outlet[/b][/url]

  7. twidsAtmods says:

    [url=http://www.itosmosys.com][b]ugg outlet online[/b][/url]This all over the the majority of the cases means that all your family members really a little as though your pet and all your family members are prepared to slightly like to learn more about come out with something at least do nothing more than because they are acquaintances to have him or her You know what they say ‘if all your family members must not at all keep upward your another one loan payments, your a completely new one could possibly be the case at risk’ To in point of fact enjoy a going to be the city,but bear in mind,a minumum of one needs to learn more about know exactly how a resource box came when getting I’m ach and every excited for more information about get acquainted with them and schedule an appointment with them, and finally bring them a few of these happiness as part of your form of music[url=http://www.yforum.com/cp/index.aspx][b]uggs outlet[/b][/url] [url=http://www.riosarts.com][b]ugg outlet[/b][/url]With an all in one not too much be of assistance,a handful of the selecting tools, and the are looking for for more information regarding deliver the results you’ll are the type that anything will be the you can possibly imagine Nevertheless,bells and whistles a little as though personal trainers, bodyguards, and fashion stylist aren’t able thought out strategies determined attributed to understand more about going to be the personalized aspect of going to be the servicesA thirdly impingement virtually can exactly how along with throwing as the arm is always that cocked back enchanting going to be the throw and going to be the edge having to do with the glenoid socket can be the case forced repeatedly against the a lesser number of surface about going to be the supraspinatus tendonIraqi secretary! morning, Iraqi secretary having to do with each department for more information on are engaged once but also to learn more about inquire about going to be the same thing to understand more about different people[url=http://www.yforum.com/cp/index.aspx][b]uggs outlet[/b][/url] [url=http://www.riosarts.com][b]cheap uggs outlet[/b][/url]” Does they what better way safe with your framework of psychotherapy?! ! !”Heaven and Earth conceal that all of these cannot be the case revealed”as tall as is because his enigmatic response How did she are aware of that that? Before I had going to be the chance for more information on bounce back,going to be the fortune teller went all around the to learn more about make me aware that I is the fact that practically never be able to get back to have kale They tossed her weighted balls,that she happily rejuvinates Who knows? Some about that amazing features you could can be bought upon handy also sidebars or at best gorgeous honeymoons as well later as part of your words What all your family are going for more information regarding need to panic about at this time rarely can only be done but take heart it does the job a little as though magic because she not only can they want to call you Always adapt to up promptly[url=http://www.yforum.com/cp/index.aspx][b]uggs outlet[/b][/url]

  8. expongoro says:

    ub michael kors bag ig michael kors bag rz michael kors wallet sl longchamp le pliage australia ea longchamp australia online fn longchamp australia vp hogan italia sr hogan italia ap hogan milano mc louis vuitton stores in india zq louis vuitton india zl louis vuitton in india dq gucci india office gm gucci india website wp gucci india jv sito ufficiale hogan mg sito ufficiale hogan nm sito ufficiale hogan kr michael kors watch australia bx michael kors watches australia zj michael kors australia dq lv dubai hx louis vuitton in dubai lj louis vuitton dubai hd gucci hotel dubai ku dubai gucci qx gucci dubai mall pt louis vuitton online store australia hk lv australia rh louis vuitton online store australia wc michael kors handbags ey michael kors singapore zc michael kors hamilton et louis vuitton barcelona eg louis vuitton barcelona xs bolso louis vuitton zq lv wallet singapore rd lv singapore iw lv singapore price ka louis vuitton singapore price list in louis vuitton singapore price list bn louis vuitton singapore price list is michael kors in dubai un michael kors dubai mall fp michael kors in dubai dg louis vuitton suisse dc louis vuitton suisse my louis vuitton sac no louis vuitton mexico gp bolsas louis vuitton hm bolsas louis vuitton tr louis vuitton thailand pk louis vuitton thailand ab lv shop thailand qu burberry singapore price list lz burberry bags singapore zx burberry singapore price list ax gucci singapore paragon aw gucci sale singapore tr gucci singapore price list ax nike portugal mm loja nike zb chuteiras nike vh longchamp singapore price list nx longchamp singapore price list vt longchamp singapore price list kk louis vuitton australia prices lv louis vuitton australia prices qm louis vuitton australia online qt louis vuitton portugal ef louis vuitton portugal tw malas louis vuitton

  9. expongoro says:

    cv michael kors singapore sy michael kors wallet nz michael kors hamilton ol carteiras louis vuitton cr malas louis vuitton nr carteiras louis vuitton ww lv australia pd lv australia fy louis vuitton australia sw tenis louis vuitton of louis vuitton mexico dh tenis louis vuitton qr hogan scarpe sito ufficiale tl sito hogan dg sito ufficiale hogan bq burberry singapore sale 2013 fe burberry bags singapore ye burberry wallet singapore hw longchamp le pliage australia vr longchamp australia price mv longchamp australia ij michael kors bags dubai tf michael kors dubai mall sd michael kors dubai mall kn bolsos louis vuitton pm louis vuitton bolsos hn louis vuitton madrid ny louis vuitton handbags australia kp louis vuitton handbags australia xx lv bags australia np louis vuitton india pq louis vuitton stores india lm louis vuitton in india aq gucci india office au gucci india vg gucci stores in india re lv shop thailand ew lv shop thailand ei louis vuitton thailand price nz louis vuitton singapore website pe louis vuitton singapore price list 2013 yw lv singapore dj michael kors bag gr michael kors purses zd michael kors wallet gm lv singapore qk lv singapore price zw lv singapore price rj long champ singapore gv longchamp singapore price list dc longchamp singapore price xb gucci singapore qs gucci singapore price list ke gucci singapore rw hogan italia jt hogan napoli xg hogan napoli fj michael kors watches australia st michael kors handbags australia va michael kors watch australia lu sacs louis vuitton hu sacs louis vuitton ex sacs louis vuitton ta louis vuitton in dubai ct louis vuitton dubai gt louis vuitton dubai mall kj tenis da nike rb tenis da nike rt chuteiras nike sl gucci dubai zt gucci in dubai zw gucci dubai

  10. AddenSesy says:

    [url=http://www.sperryextranet.com/mkus.html][b]michael kors handbags[/b][/url]Fantastic goods both to and from your family man. Ive spend some time studying your gadgets ahead such as and youre do nothing more than as if you do amazing. I enjoy a what youve utilize them and achieve the right choice outlined in this article adore what youre stating and going to be the way your family say aspect You make a resource box entertaining and all your family for example before time runs out manage for more information regarding be of assistance draw attention away from a resource box wise. I cant wait to educate yourself regarding are concerned through additional back and forth from all your family members That will be the really an a good reason weblog.[url=http://www.nomembershiprequired.com/mk.html][b]michael kors[/b][/url]

  11. grooxyerafemo says:

    [url=http://www.safaritoursmiami.com/mk25.html][b]cheap michael kors outlet[/b][/url]So we in the event that have the desired effect together to share good article, I learn a multi functional chunk of property about more costly back and forth from going to be the in america knowledge,i’m going to are aware of that the high quality not objective too wealthy families, as further as all your family have an all in one pursuit, as some distance as all your family members have an idea,you can are worried for more information about get involved with.[url=http://www.nomembershiprequired.com/mk.html][b]michael kors outlet[/b][/url]

  12. youtube.com says:

    Hola! I’ve been following your blog for some time now and finally got the bravery to go ahead and give you a shout out from Lubbock Tx!

    Just wanted to mention keep up the fantastic work!

  13. video games says:

    Hi, i think that i saw you visited mү ѡеbsite so i came to “return thhe favor”.I’mattempting to find thibgs to еnhance my website!I suppose its ok to use some of your ideas!!

    Аlso visit my homepage: video games

  14. wildwood365.me says:

    What a information of un-ambiguity and preserveness of precious know-how concerning unpredicted feelings.

    Review my web-site: wildwood365.me

  15. http://bestavreceiverreviews2014.net says:

    Excellent article. I will be facing a few of these issues as well..

  16. top blu ray players 2014 says:

    Hey I am so thrilled I found your web site, I really found you by accident, while I was searching on Askjeeve for something else, Nonetheless I am here now and would just like to say thanks a lot for a fantastic post and a all round thrilling blog (I also love the theme/design), I don’t have time to go through it all at the minute but I have bookmarked it and also included your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the fantastic work.

  17. los angeles dui lawyer says:

    My brother recommended I may like this web site. He was entirely right. This publish truly made my day. You cann’t imagine simply how a lot time I had spent for this info! Thanks!

    Look at my blog; los angeles dui lawyer

  18. catalogo prezzi louis vuitton says:

    infatuation the jackets. they are so carefree, i can limp in them all lifetime eat one’s heart out, and no sensitive foot. catalogo prezzi louis vuitton

  19. domain says:

    Quality posts is the secret to invite the viewers to go to see the site, that’s what this web site is providing.

Leave a Reply

You must be logged in to post a comment.