What is the difference between awakefromnib and viewdidload




















For view controllers unarchived from a nib, this is after the view is set. Question I recently had a problem in my app where some of the subviews I was creating in a UIViewController subclass's -awakeFromNib method were disappearing from the view. If you are familiar with the concepts from. NET, this should be enough, I think. I'll try to answer by giving an example: If define customCell class and customCell. Some related confusing methods: void loadView; This is where subclasses should create their custom view hierarchy if they aren't using a nib.

Get answers to millions of questions and give back by sharing your knowledge with others. Connect and share knowledge within a single location that is structured and easy to search. I've gotten pretty comfortable using the viewDidLoad method to execute things I want done at the beginning of a view, but reading one of Apple's tutorials they set the data controller for the class in the awakeFromNib method and did nothing in the awakeFromNib. I swapped it and it seemingly worked identically in my app, but I'm not sure if it was better to have it in awakeFromNib or viewDidLoad.

Any class that can own a nib can use it. It is usually called when loading from nib as well but it can also be called by a view created in memory very rare circumstance.

If you are using controllers, then I would suggest you to use viewDidLoad. If you need to initialize another control unarchived from the nib e. How are we doing?

Please help us improve Stack Overflow. Take our short survey. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Once verified, infringing content will be removed immediately. The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud.

If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email. If you find any instances of plagiarism from the community, please send an email to: info-contact alibabacloud. A comprehensive suite of global cloud computing services to power your business. Awakefromnib When. Viewdidload When a view object is loaded into the memory, viewdidload is executed, no matter whether the NIB file orCodeViewdidload is executed when you create an object.



0コメント

  • 1000 / 1000