A face question for iOS last week.

Source: Internet
Author: User

Beautiful face Test

1,ios is how to do memory management, what is arc.

2, when declaring the property, assign,nonatomic,readonly,retain,copy (What do you mean, the parentheses don't print out, I guess)

Does 3,delegate need retain?

4, what is designated Initlalizer? What happens after I execute [super init]?

What's the difference between 5,iskindofclass and Ismemberofclass?

6, briefly describe the life cycle of Uiviewcontroller, and the more important methods are called at what time respectively.

7,uiview's setneedslayout,layoutsubviews What to do separately, should be called at what time.

The difference between 8,uiview frame,bounds.

The difference between 9,nsarray,nsdictionary,nsset.

What are the asynchronous tasks in 10,ios?

11,ios MVC, a common design pattern.

12, implement a waterfall page, can display a lot of content, need to consider performance.

13, two Nsarray intersection (need to write code, there are several ways?) Their pros and cons? )

Extension issues.

What kind of website do you usually use?

What's new in the latest version of iOS

What open source things are used

Have you been involved in open source projects?

What languages/platforms are used outside of iOS, their pros and cons

Personal answers, not very carefully written.

1,MRR Manual Management ARC Auto Reference count can be garbage collected on Mac.

Is that you do not have to retain/relese/autorelease, in fact, you do not have to do anything, the system automatically counted, if the pointer to a piece of memory is 0, the system will delete memory.

2,copy: Create an object with an index count of 1, and then release the old object to NSString

Retain: Frees the old object, assigns the value of the old object to the input object, and then increases the input object's index count to 1 for the other nsobject and its subclasses

Retain is a pointer copy, copy is a copy of the content

ReadOnly This tag indicates that the property is read-only

Assign: Simple assignment, does not change the index count;

Nonatomic: Non-atomic access, when assigning values to attributes without locking, multi-threaded concurrent access improves performance. If this attribute is not added, the default is two access methods are atomic transaction access. first, the original variable is released, then the new variable is retain and then assigned value;

3, first delegate (delegate) to use assign instead of retain

An object does not have to manage its own delegate life cycle, or there is no need to have the object, so we just need to know its pointer, and use the pointer to find the object to invoke the method, that is, the sense of trust implementation.

Or we can change the point of view from memory management to explain the problem. The delegate life cycle does not need to be controlled by the object, and if the object uses retain on it it is likely that the object pointed to by delegate is not properly disposed.

4, Initializes a subclass object, [Super Init] initializes the parent class.

5, we can use Iskindofclass to determine whether an object is an instance of a class, or an instance of an ancestor class of that class.

Ismemberofclass can only be used to judge the former, not to judge the latter.

It can be said that Ismemberofclass cannot detect the fact that any class is based on the NSObject class, and Iskindofclass can.

6, when a view controller is created and displayed on the screen. Order of execution of code

1, Alloc create objects, allocate space
2. Init (Initwithnibname) initializes the object, initializes the data
3, Loadview from the nib load view, usually this step does not need to interfere. Unless you're not using the Xib file to create a view
4, Viewdidload loading complete, can be customized data and dynamic creation of other controls
5, Viewwillappear View will appear before the screen, the view will be displayed on the screen immediately
6, Viewdidappear view has been rendered on the screen completed

When a view is removed from the screen and the execution order is destroyed, the order is almost the opposite of the above
1. Viewwilldisappear view will be removed from the screen before execution
2, Viewdiddisappear view has been removed from the screen, the user can not see this view
3. Dealloc view is destroyed, you need to release the objects you created in Init and viewdidload

About Viewdidunload: In the event of a memory warning, if this view is not the view being displayed on the current screen, Viewdidunload will be executed and all child views of this view will be destroyed to free up memory, when developers need to manually viewload, The objects created in the Viewdidload free memory. Because when the view is displayed again on the screen, Viewload and viewdidload are called again to construct the view again.

Here is the copy paste online, or abbreviated.

7,setneedslayout will call Layoutsubviews by default and can handle some of the data in the child view.

The layoutsubviews is called in the following cases:

(1) Init initialization does not trigger layoutsubviews.

(2) Addsubview will trigger layoutsubviews.

(3) Setting the frame of the view will trigger Layoutsubviews, of course, if the frame value has changed before and after the setting.

(4) scrolling a uiscrollview will trigger layoutsubviews.

(5) Rotating screen triggers the Layoutsubviews event on the parent UIView.

(6) Changing the size of a uiview also triggers the Layoutsubviews event on the parent UIView.

(7) Call Setlayoutsubviews directly

8,

Frame and bounds are the two properties in the UIView.

Frame refers to the position and size of the view in the parent view coordinate system. (The reference point is the father's coordinate system)

Bounds refers to the position and size of the view in its own coordinate system. (The reference point is its own coordinate system)

9,

Nsarray for an ordered set of objects (equivalent to an array)

Nsset is used for object unordered collection (not contiguous in memory storage location, cannot be accessed by the following table in array arrays, the lookup is more efficient when traversing according to the have code)

Nsdictionary for key-value mappings

The above three types of collections are immutable and cannot be changed once initialized

10,

Dispatch_async submits a Block Object to the dispatch queue for asynchronous execution,

Dispatch_async_f submits a C function and a context reference to the dispatch queue for asynchronous execution

Operation Run the task asynchronously,

11,MVC a software system into three parts: Model,view,controller. In cocoa, every object in your program will obviously belong to only one of these three parts, but not the other two at all.

Factory mode, observer mode.

13,

Method One: Use UITableView. Method Two: Use Uiscrollview

14.

Nsarray the intersection, this is simple, first not stick.

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.