iOS pen question 04

Source: Internet
Author: User

1. Object-cdo you have multiple inheritance? What's the substitute for nothing? ?

1> OC is single inheritance, no multiple inheritance

2> can sometimes replace multiple inheritance with categorical category and protocol Protocol

2. Object-cdo you 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 use class extension (Extension)/ inheritance to add private methods and private variables

3. KeywordsConstWhat does that 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??Heapand theStackthe difference?

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 many built-in classes, such asTableViewof theDelegatethe properties areAssignis notretain? ?

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

What are the consequences of the 3> cycle?

8. When defining attributes, what happens when you useCopy,Assign,retain? ?

1> copy:nsstring,Block and other types

2> Assign: Non- OC Object type, basic data type (two objects referencing each other, one end with retain, one end with Assign )

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, which is destroyed when the object's counter is reduced to 0 .

Ten. Viewcontrollerof theLoadview,Viewdidload,Viewdidunloadwhen are they called, in the customViewcointrollerwhat should be done in these several functions?

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)

Viewcontroller.of thedidreceivememorywarningwhen was the call? 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

12. How to UnderstandMVC, inCocoainMVCHow did it come true? ?

1> M:model, models, package data

2> V:view, viewing interface, responsible for displaying data

3> C:Controller, controllers, responsible for providing data (Model) to the interface (View)

Self.with SelfWhat's the difference??

1> self. is called Get method or Set Method

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

3> self-> is a direct access member variable

Id,NilWhat does it mean?

A pointer to the 1> ID type can point to any OC Object

2> Nil represents a null value (null pointer value, 0)

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

profile-> Instruments->time Profiler

iOS pen question 04

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.