Re: Is it safe to assume that viewDidLoad() is only ever called once on iOS 8.0+?
Re: Is it safe to assume that viewDidLoad() is only ever called once on iOS 8.0+?
- Subject: Re: Is it safe to assume that viewDidLoad() is only ever called once on iOS 8.0+?
- From: Andreas Falkenhahn <email@hidden>
- Date: Sun, 18 Dec 2016 18:18:40 +0100
On 18.12.2016 at 17:01 Alex Zavatone wrote:
> Allocate them in viewWillAppear: if they are nil.
> Just create a conditionalInit method for the purpose of this and put it inside viewWillAppear.
Reading the documentation again, it now seems to me that views should
be created in loadView() instead. The documentation of loadView() says
that "You can override this method in order to create your views manually."
I've seen lots of code that allocates subviews in viewDidLoad(), though.
But I guess that's wrong then?
Your suggestion of using viewWillAppear() doesn't make things clearer, alas,
because this even adds a third candidate for view allocation... so is there a
definite answer as to where to allocate my subviews like UIButton, UILabel,
etc. for my UIViewController?
--
Best regards,
Andreas Falkenhahn mailto:email@hidden
_______________________________________________
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