1. Have you used OBJECTIVE-C runtime programming (runtime programming)? If you have used it, what have you done with it? Can you remember the name of the relevant header file or some method you used?
The important feature of the OBJECITVE-C is runtime (runtime), which can be seen in #import <objc/runtime.h>, using Objc_getclass () and Class_copymethodlist () acquired a private API;
"' Objective-c
Method method1 = Class_getinstancemethod (CLS, sel1);
Method method2 = Class_getinstancemethod (CLS, SEL2);
Method_exchangeimplementations (Method1, METHOD2);
```
Code Exchange two methods, which are used when writing unit test.
2. Do you implement too many threads of core data? Which of the nspersistentstorecoordinator,nsmanagedobjectcontext and Nsmanagedobject need to be created or passed in the thread? What kind of strategy do you use to achieve this?
CoreData not implemented too many threads (to be practiced)
<!--more-->
3. The contents of the series beginning with the core. Whether Coreanimation and coregraphics have been used. What is the interface between the UI framework and the CA,CG framework? What animations or images are done with CAs and CG, respectively. (Some of the contents of quartz can also be involved if necessary)
The bottom of the UI framework is coreanimation,coreanimation with Coregraphics.
UIKit |
------------ |
Core Animation |
Core Graphics |
Graphics hardware|
Use the CA to expand the menu (too lame)
4. Have you ever used Coretext or coreimage? If used, please talk about your experience using Coretext or coreimage.
Coretext can solve complex text content typesetting problems. Coreimage can process pictures and add various effects to them. The experience is very powerful and quite complex.
5. What are the differences and usages of nsnotification and KVO? When should I use notifications, when should I use KVO, and what are the differences in their implementation? Is it possible to implement a similar function with protocol and delegate (or an array of delegate)? If possible, what are the potential problems? If not, why? (Although protocol and delegate this kind of thing interview has been rotten ... )
Nsnotification is the implementation of the notification mode in iOS, the full name of KVO is the key value observation (Key-value observing), which is based on KVC (Key-value coding), and KVC is a mechanism for accessing property variables through property names. For example, you can use nsnotification when notifying the change of the module layer to multiple controller objects, or you can use KVO if you want to observe only one of the properties of an object.
For the delegate mode, in design mode is the object adapter pattern, which is that delegate is pointing to an object, which is a one-to-many relationship, and in notification mode, is often a one-to-multiple relationship. The delegate mode, which is technically possible to change the object that delegate points to, is not recommended, and can be confusing if a delegate object is constantly changing, pointing to a different object.
6. Have you ever used nsoperationqueue? If used or understood, why do you use Nsoperationqueue to achieve what? Please describe the differences and similarities between it and GCD (hint: it can be described from the implementation mechanism and scope of application).
Use Nsoperationqueue to manage subclasses of Nsoperation objects and control their number of threads concurrently. Both GCD and nsoperation can implement thread management, except that nsoperation and Nsoperationqueue are multi-threaded object-oriented abstractions. The advantage of using nsoperation in a project is that Nsoperation is a high abstraction of the thread, using it in the project, will make the program structure of the project better, the sub-class nsoperation design idea, is has the object-oriented advantage (multiplexing, encapsulation), so that the implementation is multi-threaded support, The interface is simple and recommended for use in complex projects.
The advantage of using GCD in a project is that the GCD itself is very simple and easy to use, saving code for uncomplicated multithreaded operations, and the use of block parameters is more readable and recommended for simple projects.
7. Since the mention of GCD, then ask what to pay attention to when using GCD and block? Are they two a thing? What is the difference between block behavior and usage in arc and the traditional MRC, and what do you need to be aware of? How do I avoid circular references?
Using block is important to note that if the block is to be used as a function parameter, you need to put it to the end, GCD is a Grand Central Dispatch, is a thread-open source class library, and block is a closure, is able to read other functions inside variables function.
8. Have you worked on asynchronous network processing and communication? If so, can you specifically introduce some implementation strategies?
Use Nsoperation to send asynchronous network requests, use Nsoperationqueue to manage the number and priority of threads, the underlying is nsurlconnetion, detailed visible open source framework [lwconnetion] (https://github.com /xunyn/lwconnetiondemo).
9. What do you think is the biggest advantage and the biggest disadvantage for objective-c? For the shortcomings, there are now no available methods to circumvent these deficiencies to achieve the requirements. If so, have you considered or practiced some of the features of OC, and if so, how will you do it?
The biggest advantage is its run-time characteristics, the lack of a namespace, for naming conflicts, you can use the long or special prefixes, if it is the introduction of a naming conflict between third-party libraries, you can use the link command and flag to resolve the conflict.
10. Have you implemented a framework or library for others to use? If so, talk about the experience of building a framework or library, and if not, imagine and design the API for the public of the framework, and point out how you might want to do it and what you need to pay attention to to make it easier for others to use your framework.
Abstraction and encapsulation for ease of use. The first is to have a full understanding of the problem, such as the construction of a file decompression compression framework, from the user's point of view, just focus on sending to the framework of a decompression request, the framework to complete the decompression of complex files, and in due time to notify is oh sad, such as decompression completed, decompression error. Build the relationships of objects within the framework, making them more robust and easy to change through abstraction. followed by the API's documentation.
iOS Top ten classic face questions