iOS Basics points Summary

Source: Internet
Author: User

1. Memory Partitioning conditions:

A. Code area: Store function binary code;

B. Data area: System runtime request memory and initialization, system release from the system, the main storage constants, static variables, global variables;

C. Heap area: Through the functions of malloc or new dynamic application to, requires the programmer to manually apply and release;

D. Stack area: Application within the function module, automatically released by the system at the end of the function. Store local variables, function parameters.

2. Differences between queues and stacks:

Queue and Stack are two different data containers, from the data structure point of view are linear structure, the difference is that the queue is a first-out data structure, at both ends of the queue can be the operation of data, one end into the queue operation, the other end of the queue operation, and for the stack, the stack is advanced out of the way, And the data can only be manipulated at the top of the stack.

Differences between post and get requests in the 3.HTTP protocol

POST request:

A. The submitted parameters are contained within the message body, and the requested data is not visible to the outside world;

B. There is no limit to the size of submitted data;

C. Bookmarks can be set

GET Request:

A. The submitted parameters are not included in the message body, the data is placed in the request line

B. The size of the submitted data is limited

C. You cannot set bookmarks

Three core concepts of the 4.Quartz 2D drawing function

Context: Primarily used to describe where graphics are written

Path: is the content drawn on the layer

Status: Values, fills, and outlines for saving configuration changes

The difference between Nsinteger and int in 5.objective-c

Nsinteger is a primitive data type object, not a subclass of NSNumber, or a subclass of NSObject. Nsinteger is an alias of int or long, except that Nsinteger determines whether it is an int or a long based on whether the system is 32-bit or 64-bit

What are the methods for creating threads in 6.objective-c? What is the way to execute code in the main thread? What is the method of delaying code execution?

There are three main ways to create a thread: Create with Nsthread, create with GCD dispatch, use a subclass of Nsoperation, and then add it to nsoperarionqueue. Execute the code in the main thread, by Performselectoronmainthread, if you want to defer execution of code with PerformSelector:onThread:withObject:waitUntilDone:

7. Comparison of categories, class extensions, and inheritance

Categories can only add methods, cannot add attributes, class extensions and inheritance can add attributes, inheritance can be deleted, modify methods, analogy cannot, class extensions added methods must be implemented, class extensions like private categories

Links and differences between 8.UIView and Uiwindow,calayer

UIView is the EOG class, Uiviewcontroller is the view Controller base class, and Uiresponder is an object that can be used to represent a touch event on the screen.

UIWindow is a subclass of UIView, there are two main functions, one is to provide a region to display UIView, two is used to distribute events, an application basically only a uiwindow.

The difference between Calayer and UIView:

Calayer is inherited from NSObject, and UIView's inheritance structure is uiresponder:nsobject, from the two inheritance structure can be seen, UIView can respond to touch events, and Calayer is not responsive to touch events, the two belong to the framework is also different , UIView from the Uikit framework, Calayer from the Quartzcore framework, Calayer's coordinate system has a anchorpoint attribute.

The difference between 9.__block and __weak

__block can be used either in arc or MRC, can be decorated with objects, or can be used to modify basic data types

__weak can only be used in ARC mode and can only be decorated with objects and cannot be decorated with basic data types

__block objects can be re-assigned in the block, __weak cannot be

10. What are the common HTTP status codes?

HTTP status code: 302 for Request redirection, more than 500 is a server error, more than 400 is an address error or cannot find the server, more than 200 is correct, more than 100 is the request to accept success.

The role of 11.static keywords

The static variable in the function body is scoped to the function body, and the memory of the variable is assigned only once, and its value is maintained at the next call.

The static member variable in the class is owned by the entire class and has only one copy of all objects of the class

The static member function in a class belongs to the entire class, which does not receive the this pointer, so it can only access the static member variables of the class

12. Heap and Stack differences

On the management way, the stack is managed by the compiler itself, and the heap is managed by the programmer.

Application size, the stack is to the low address extension of the data structure, is a contiguous area of memory, the top of the stack address and the maximum capacity of the stack is the system pre-defined, can be obtained from a small space; The heap is a data structure that extends to the high address and is a discontinuous memory area. Using the way of the chain list storage, the size of the heap is limited by the effective virtual memory in the system size, the heap to obtain more flexible space, also relatively large.

Fragmentation problem, the heap will be frequently applied, released, and not continuous, easy to create a large number of fragments, for the stack, it will not cause debris space, because the station is advanced, is a contiguous memory area

On the efficiency of allocation, the stack is managed by the compiler, and the allocation efficiency is a bit higher.

iOS Basics points Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.