iOS written question one

Source: Internet
Author: User

?

How much does object-c inherit? What's the substitute for nothing?

OC is single inheritance, no multiple inheritance

Sometimes you can use classifications and protocols instead of multiple inheritance.

Does Object-c have a private method? What about private variables?

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

Can be declared and implemented directly in a. m file (such as a class extension), which is private to the compiler

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)

The role of static?

The static modifier is an intrinsic function that can only be called in this file, and other files cannot be called

All variables of the static modifier are an internal variable that can only be used in this file and cannot be used by other files

The static modified local variable is initialized only once and the memory is reclaimed when the program exits

What are the differences between threads and processes?

One application corresponds to a process, one process helper takes up a piece of storage space

To perform a task in a process, you must turn on the thread, and a thread represents a task

Allows multiple threads to be opened in one process, i.e. multiple tasks simultaneously

The difference between heap and stack?

The memory of the heap space is allocated dynamically, generally storing the object, and the memory needs to be freed manually

The memory of the stack space is automatically assigned by the system, and the local variables are usually stored, so it does not need to manage memory manually

Why are the properties of many built-in classes, such as TableView delegate, assign not retain?

TableView's agent is generally the controller that it belongs to, and the controller will do a retain operation on its internal view.

Assuming that TableView also does a retain operation on the agent (Controller), there is a cyclic retain problem

When defining attributes, what is the use of copy, assign, retain?

Copy:nsstring, block and other types

Assign: Basic data type

Retain:oc Object Type

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)

When are Viewcontroller's Loadview, Viewdidload, and Viewdidunload called, and what should be done in these functions when customizing Viewcointroller?

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

Viewdidload

Called when the controller's view is created, that is, after Loadview

It is common to add child controls, initialize data

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 the application receives the system's content warning, it is possible to call the controller's didrece ... Warning 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

How do you understand MVC and how is MVC implemented in cocoa?

M:model, model, package data

V:view, view interface, responsible for displaying data

C:controller, Controller, responsible for providing data (Model) to the interface (View)

Self. What's the difference with self->?

Self. Is the call to get method or set put

Self is the current itself and is a pointer to the current object

Self-> is a direct access member variable

What does ID and nil mean?

A pointer to the ID type can point to any OC object

Nil represents a null value (the value of a null pointer)

How do I perform a performance test on my iOS device?

Timer profile

iOS written question one

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.