Knowledge points and techniques used in iOS interviews, and ios interview knowledge points
1. What is the life cycle of the APP and viewcontroler?
A: APP lifecycle: there are seven phases in APP Proxy:
1. Start
2. Started
3. Enter the inactive status
4. Go to the background
5. Enter the foreground from the background
6. Enter the activity status
7. Memory alarms
Viewcontroller lifecycle: (7)
LoadView-> viewDidLoad-> viewWillAppear-> viewDidAppear-> viewWillDisAppear-> viewDidDisAppear-> delloc
2. multithreading: NSThread, NSOperation, and GCD
NSOperation is an abstract class and does not have the ability to encapsulate operations. It must be used as a subclass of NSOperation:
NSInvocationOperation (using proxy)
NSBlockOperation (using block)
GCD ---
Grand Central Dispatch
(GCD) is a new solution developed by Apple for multi-core programming.
- GCD can be used for parallel operations on multiple cores
- GCD will automatically use more CPU cores (such as dual-core and quad-core)
- GCD automatically manages the thread lifecycle (creating threads, scheduling tasks, and destroying threads ).
- The programmer only needs to tell GCD what task to execute and does not need to write any thread Management Code.
Before learning about GCD, we should first understand two core concepts in GCD: task and queue.
Task: Indicates the execution operation. In other words, it indicates the code that you execute in the thread. It is placed in a block in GCD. There are two ways to execute a task:Synchronous executionAndAsynchronous execution. The main difference between the two is: whether the new thread can be enabled.
- Synchronous execution (sync): The task can only be executed in the current thread, and the new thread cannot be enabled.
- Asynchronous execution (async): it can execute tasks in new threads and has the ability to enable new threads.
- Queue: The queue here refers to the task queue, which is used to store the task queue. A queue is a special linear table that adopts the FIFO principle, that is, new tasks are always inserted to the end of the queue, reading tasks always start from the header of the queue. Each time a task is read, a task is released from the queue. There are two types of queues in GCD:Serial queueAndConcurrent queue.
Want to learn more about GCD to see: http://www.jianshu.com/p/2d57c72016c6
- 3. How does one pass the value of a single instance, proxy, attribute, notification, or block?
- Attribute value transfer is easy to understand. A-> B exposes an attribute in. h of B. You can directly call B's instance in A to assign values. It is also the simplest value passing method.
- A-> B declares in A that the Protocol complies with the Protocol in B and implements the Protocol method.
- B-> A: indicates that the reverse transfer value declares in B that Protocol A complies with the protocol. ----- when A pushes data to B, it complies with the protocol, it is very easy to set proxy and implement proxy method when B pops back to A and use its own proxy to execute proxy method (that is, to assign the value in B to the parameter in proxy method ).
- You only need to remember the reverse value passing by proxy who declares that the Protocol receiver implements the proxy method push and follows the Protocol to set the proxy pop before executing the proxy method (assign value)
- Block values are divided into forward and reverse values.
Forward value A-> B declare A block in A. Implement block before block Apush. When block B is assigned A value, call block. This block should be A block with parameters and return values.
Reversely pass the value B-> A. Declare A block in B. Before Apush, call block before implementing block Bpop. This block should be A block with parameters.
Values transmitted in a single example are also divided into forward and reverse values.
If you do not want to pass the value in the forward direction, it is simply an intermediary, A-> B A-> C->.
If values are passed in the reverse direction, B-> A Bpop assigns the value to the object that instantiates A when the interface disappears and assigns the value of the singleton to A. (I feel that it is not as good as A direct attribute. assign values, but the Singleton is useful for data sharing)
4. Three major design frameworks: MVC, MVVM, and MVP
MVC
Defects:
It's really good to write it. Just take it.
MVVM:
MVP:
5. singleton proxy (delegate) observer (observer) action/target mechanism (target/action) and other common design patterns
Singleton:
Proxy:
Observer:
Action/target mechanism:
I hope to get a thumbs up and give me some encouragement.
This is the first chapter of the summary of the interview questions, there are a lot of things.
Next there is the second chapter or my book address to see: http://www.jianshu.com/users/795c2ec428fd/latest_articles also collected some dry goods.
Thank you for your support.