1. App life cycle and Viewcontroler life cycle?
A: App life cycle: There are seven stages in the app's agent:
1. Will start
2. Already started
3. Going into an inactive state
4. Go backstage
5. Enter the foreground from the backstage
6. Go to Active state
7. Memory Alarm
Viewcontroller life cycle: (also seven)
Loadview->viewdidload->viewwillappear->viewdidappear->viewwilldisappear->viewdiddisappear-> Delloc
2, Multithreading: Nsthread, Nsoperation, GCD
Nsoperation is an abstract class and does not have the ability to encapsulate operations, it must make a subclass of it:
Nsinvocationoperation (using proxies)
Nsblockoperation (using block)
GCD---
Grand Central Dispatch
(GCD) is a newer approach to multi-core programming developed by Apple
- GCD can be used for multi-core parallel operations
- GCD will automatically take advantage of more CPU cores (such as dual-core, quad-core)
- GCD automatically manages the life cycle of threads (creating threads, scheduling tasks, destroying threads
- Programmers just need to tell gcd what tasks they want to perform, without having to write any thread management code
Before you learn gcd, learn about the two core concepts in GCD: Tasks and queues
task : The meaning of the action, in other words, the code that you execute in the thread. In the GCD is placed in the block. There are two ways to perform tasks: synchronous execution and asynchronous execution . The main difference is whether you have the ability to open new threads.
- Synchronous Execution (Sync): Tasks can only be performed in the current thread, without the ability to open new threads
- Asynchronous Execution (Async): A task can be executed in a new thread with the ability to open a new thread
- Queue : The queue here refers to the task queue, which is the queue used to hold the task. A queue is a special linear table with a FIFO (first-in-one-out) principle, in which new tasks are always inserted at the end of the queue, while read tasks are always read from the head of the queue. For each task read, a task is freed from the queue. There are two types of queues in GCD: serial queues and concurrent queues .
Want to know more about GCD to see: http://www.jianshu.com/p/2d57c72016c6
- 3, single case, agent, attribute, notification, block of the value-transfer technology?
- Property passing values are well understood. A->b a property in the. h of B, it is possible to invoke the instance of B directly in a to assign a value. It's also the simplest way to pass a value.
- Proxy value A->b in a, it is easier to declare the protocol in B and implement the Protocol.
- B->a that is, the reverse value in B is declared in protocol A to follow the protocol-----in a to push to B when the protocol, set up the agent and implement proxy method in B pop back to A when the agent method with its own agent (that is, the value in B is assigned to the parameters in the proxy method) is not very simple
- As long as you remember the proxy reverse value, the proxy method is executed before the proxy pop, which declares the protocol to the receiver to implement proxy methods (Assignment).
- The value of block is divided into forward value and inverse value.
Forward value A->b when a block Apush is declared in a, block B is called when the block is to be assigned the block should be a block with parameters and return values
Reverse value B->a Call block before implementing block Bpop before declaring a block Apush in B. This block should be a block with parameters
The single-pass value is also divided into positive and negative values.
The forward value is not said to speak plainly is a middle person a->b a->c C->a
The inverse value is B->a bpop when the value is assigned to a single case when the interface disappears, the object that instantiates a assigns the value of a singleton to a (feeling superfluous is not as good as the direct attribute assignment but the singleton is useful in data sharing)
4. Three design frameworks of MVC, MVVM and MVP
Mvc
Defects:
It's so good, it's going to come straight to me.
MVVM:
Mvp:
5, single (singleton) agent (Delegate) observer (Observer) Action/target mechanism (target/action) and other common design patterns
Single Example:
Agent:
Observed by:
Action/target mechanism:
Summary of the good, hope to harvest a praise to the point of encouragement
This is the first chapter of the interview, and there's a whole lot of stuff.
Then there is the second chapter or my book address to see: Http://www.jianshu.com/users/795c2ec428fd/latest_articles also collects some dry goods.
Thank you for all your support.
Some of the knowledge points and techniques used in iOS interviews