Home » IOS » High frequency iOS in the interview questions

High frequency iOS in the interview questions

1, MVC

a: MVC is one of the software design patterns, architecture level design patterns,

B:, M (model), V (view), C (controller),

Model model: mainly responsible for storing and operating data

View view: primarily responsible for displaying data and user interaction

Controller: mainly responsible for the link between model and view: get data from the network data model to assign - > > model data will be transmitted to the veiw display (response) delegate and datasource view veiw
) - > refresh

The low coupling between view and model (model and view are not related in theory), code maintenance, modification and extension, is very convenient. It improves the efficiency of software development and saves the development cost.

2, polymorphism

basically delays the determination of data types from compile time to run time.

The problem is actually shallow, involving two concepts, run time and polymorphism.

In simple terms, the runtime mechanism that's until run time to determine an object category, and call the class object of the specified method. Polymorphism: the ability of different objects in their own way to respond to the same message called
What is the biological hypothesis (life) with a same method that belongs to -eat; human creatures, the pig also belongs to the biological, inherited life, realize their own eat, but we only need to call the call is the eat
That is, different objects respond to the same message in their own way (in response to the eat selector).

Therefore, it is also possible to say that the runtime mechanism is the basis for polymorphism.

3, a brief account of the basic principles of memory management
If you use

alloc, copy retain (mutableCopy) or an object, you have an obligation to, it sends a release autorelease message or other methods. The object is created, you don't need to manage the memory of.

4, why is delegate (proxy) property all assign instead of retain?

prevents circular references so that objects cannot be properly freed from.

5, a brief description of the common design patterns

single case design, agent design, observer (notification), factory method, template method,

6, the advantages and disadvantages of OC language

(1) advantages: categories, dynamic identification, support C language, OC and C++ mixed with

(2) disadvantages: Unsupported namespace, operator overloading is not supported, multiple inheritance

is not supported
7, the distinction between proxy delegate and notification Notification, block

delegate and block are generally used in two to 1 between the 1 objects of communication, delegate needs to define the protocol method, protocol method proxy object, and the need to establish agency relationship can realize the communication of.Block is more concise, do not need to define the protocol method is tedious, but if communication events more, recommend the use of delegate.Notification is mainly used for 1 cases of communication, and communication between objects do not need to establish relationship! But notice

poor readability
8, how do you understand delegate?

delegate, also known as principal or agent, he is a kind of design pattern of.Delegate is mainly used for communication between even the objects, and the coupling of the two outstanding communication object, iOS is used in a large number of Oh delegate design, mainly for use between view and object communication interaction.

9, when are the loadView, veiwDidLoad, and veiwDidUnload of the controller ViewController called?

(1) loadView call: when the following view view of the controller is empty and the view is accessed, the
is called
(2) call viewDidLoad
after the loadView call
(3) before iOS6.0, when the memory warning, first uninstall the view, and then call viewDidUnload to release the memory

10, what is dynamic binding (polymorphism)?

is the embodiment of the object-oriented dynamic binding characteristic of polymorphism, a variable declaration, can bind different objects at run time, such as the parameters of the method declared in such a variable UIView *view, the running time, we can according to different application scenarios for the view variable into different objects can be passed a UIButton object can be passed UIImageView object.

11, what are the similarities and differences between block and function, what are the advantages of block?

(1) block is similar to the function pointer in C. It can be passed as a parameter for callback, but the implementation of block can be defined in the method, and the function can not.

(2) block syntax is concise, you can define the implementation in the method, so you can access the local variables in the method, so that the code is more compact, structured

12, cocoa touch framework

UIKit, Foundation, CoreGraphic, CoreAnimation,

(1) audio and video



Media Library

AV Foundation

(2) data management

Core Data


(3) graphics and animation

Core Animation


Quartz 2D

Core Graphic

(4) user application

Address Book

Core Location

Map Kit

Store Kit

What is the difference between the 12 stack structure and the queue?

stack (Stack) is a linear table that defines only the insertion and deletion operations at one end of the table.

A queue (Queue) is a linear table that only inserts at one end of the table and operates at the other end.

1, the queue FIFO, the stack advanced after the.

2, to limit the insert and delete operations. The stack is limited to only insert and delete the linear form one end of the table. The queue is defined only for linear table insert and operate at the other end of the table in the end of
3, the data traversal speed is different. The queue traversal speed is much faster than

Is there multiple inheritance in 13 OC and how multiple inheritance is achieved?

(1) does not inherit much.

(2) all classes in cocoa are subclasses of NSObject, and multiple inheritance is implemented here using the project delegate agent.

(3) most of the object oriented languages are single inheritance, such as: Java, c#,

(4) c++ is a

that supports multiple inheritance

copyright notice: This article is original article for blogger. Without permission from blogger,.

must not be reprinted