iOS interview (8)

Source: Internet
Author: User

Does the 1.iPhone OS have garbage collection (GC)?

Answer: No. There is no garbage collection mechanism when the iphone is developed.

2. What is notification?

A: Observer mode, controller to defaultnotificationcenter add their own notification, other classes to register the notification can receive notification, These classes can do their own operations when receiving notifications (the observers are notified by default in random order by multiple observers, and each observer waits until one of the current observers has been completed before it is time for him to operate, and can be notificationqueue to arrange the observer's reaction sequence, You can set the reflection time in the Add observer, and the cancellation of the observation needs to be signed out in both Viewdidunload and Dealloc.

Reference Link: http://useyourloaf.com/blog/2010/6/6/delegation-or-notification.html

3. When to use delegate, when to use notification?

A: Delegate for one-to-one relationship, and reciever can return a value to Sender,notification can be for One-to-one/many/none, Reciever cannot return a value to sender. Therefore, delegate is used by sender to receive a function feedback value to reciever, notification is used to notify multiple object of an event.

4. What are KVC and KVO?

A: KVC (key-value-coding) Internal implementation: an object in the call to SetValue, (1) First find the method name according to the parameters of the environment required to run the method. (2) He will combine the environment parameters from his own Isa pointer to find the specific method implemented by the interface. (3) The specific method can be directly found. KVO (key-value-observing): When the observer registers the attributes of an object, the ISA pointer points to an intermediate class instead of the real class when the object's ISA pointer is modified. So the ISA pointer does not actually need to point to the real class of the instance object. So our program is best not to rely on the ISA pointer. When invoking a method of a class, it is best to clarify the class name of the object instance.

When did the 5.ViewController Loadview, Viewdidload, Viewdidunload, respectively, be called?

A: What should be done in these functions when customizing Viewcontroller? A: Viewdidload is called when the view is initialized from the nib file, Loadview is called when the controller's view is nil. This method is called when the program implements view, and the view controller registers the memory warning notification by default, and Viewdidunload is called when any view of the view controller is useless. In this case, the retain view release will be implemented, and if it is retain's Iboutlet view property, then Release,iboutlet will not be responsible for release.
When was the didreceivememorywarning of 6.ViewController called? What is the default action?

Answer: Default call [Super Didreceivememorywarning]

iOS interview (8)

Contact Us

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.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.