Interview written essence (iv)
1. Do object-c have multiple inheritance? If not, what's the substitute for??
1> OC is single inheritance, no multiple inheritance
2> can sometimes replace multiple inheritance with classifications and protocols
2. Does object-c have a private method? What about private variables??
1> OC does not have a @private-like modifier to modify the method, as long as it is written in the. h file, which is the public method
2> can be declared and implemented directly in. m files (such as class extensions), which is private to the compiler
3. What does the keyword const mean?
const int A;
int const A;
const int *a;
int const *A;
int * const A;
int const * const A;
1> the first two functions are the same: A is a constant integer number
2> third to fourth means a is a pointer to a constant integer number (the integer number is not modifiable, but the pointer can)
3> Fifth means: A is a constant pointer to an integer number (the integer number pointed to by the pointer can be modified, but the pointer is not modifiable)
4> last means: A is a constant pointer to a constant number (the integer number pointed to by the pointer is not modifiable and the pointer is not modifiable)
4. The role of static?
The 1> static modifier is an intrinsic function that can only be called in this file, and other files cannot be called
All variables of the 2> static modifier are an internal variable that can only be used in this file and cannot be used by other files
3> static modified local variables are initialized only once and the memory is reclaimed when the program exits
5. What are the differences between threads and processes?
1> an application corresponds to a process, a process helper occupies a piece of storage space
2> to perform a task in a process, you must turn on the thread, and a thread represents a task
3> allows multiple threads to be opened in one process, that is, performing multiple tasks at the same time
6. What is the difference between heap and stack??
The memory of the 1> heap space is dynamically allocated, typically storing objects, and requires manual memory release
The memory of the 2> stack space is automatically allocated by the system, usually storing local variables, and does not need to manage the memory manually
7. Why are many built-in classes, such as TableView's delegate properties, assign not retain??
1> TableView Agent is generally the controller that it belongs to, the controller will do a retain operation of its internal view
2> assumes that TableView also do a retain operation on the agent (Controller), then there is a cyclic retain problem
8. When defining attributes, what is the use of copy, assign, retain??
1> copy:nsstring, block and other types
2> Assign: Basic data type
3> Retain:oc Object Type
9. When was the object released??
Each object has a reference counter, and the counter for each new object is 1, and when the object's counter is reduced to 0 o'clock, it is destroyed
The reuse mechanism of TableView??
Here's just a brief description: Put the cell leaving the screen in the cache pool and re-show it to another location on the screen (other details)
What are the Loadview, Viewdidload, and Viewdidunload of Viewcontroller, and what should be done in these functions when customizing Viewcointroller?
1> Loadview
- When using the controller's view for the first time, the Loadview method is called to create the view
- In general, customize the view here
2> Viewdidload
- Called when the controller's view is created, that is, after Loadview
- It is common to add child controls, initialize data
3> Viewdidunload
- Called when the controller's view is destroyed because of a memory warning
- Usually here to recycle the interface-related resources (the interface will be destroyed, and interface-related resources must not be)
When was the didreceivememorywarning of Viewcontroller called? What is the default action??
- When an application receives a content warning from the system, it is possible to call the controller's Didreceivememorywarning method
- Its default practice is to:
When the controller's view is not displayed on the window, it is destroyed directly and the Viewdidunload method is called
13. How do you understand MVC, and how is MVC implemented in cocoa?
1> M:model, model, encapsulated data
2> V:view, view interface, responsible for displaying data
3> C:controller, CONTROLLER, responsible for providing data (Model) to the interface (View)
What's the difference between self and self->?
1> self. is to call the Get method or set put
2> Self is the current itself and is a pointer to the current object
3> self-> is a direct access member variable
What does the ID and nil represent?
A pointer to the 1> ID type can point to any OC object
2> nil represents a null value (the value of a null pointer)
16. How do I perform a performance test on my iOS device?
Timer profile
iOS Development--Interview written essence (iv)