iOS Interview Summary-

Source: Internet
Author: User

Knowledge of a C language method

1:const Static Voilite What does the rhetorical variables mean?

Const rhetoric variables are constants, constants are not allowed to modify.

Static variables are variables that are created only once in memory (for example, the proxy method for creating a cell in UITableView uses a static variable to identify the cell)

Volatile defines a variable as a shared variable

The role of 2:static

A variable that is static in a class belongs to all of the entire class and shares a copy of all objects of the class

The method of static rhetoric in a class belongs to this class, and the method cannot be accessed through this method only through the class.

The variable in the function body static rhetoric is allocated only once in memory, and multiple calls to the function body are called in the same part of memory.

Memory aspects in two OC.

How to Manage memory in 1:oc

When an object calls Alloc/retain/copy's method, the object's reference counter is incremented by 1, and when the object is not in use, it is called Release/autorelease to release it.

the difference between 2:release and autorelease.

When the object calls release, the object's reference counter is reduced by 1.

When an object invokes the Autorelease object reference counter, it is placed in the most recent auto-release pool, and the object's reference count is reduced by 1 when the program executes an out-of-scope auto-release pool.

3:readwrite ReadOnly Assign retain copy atomic nonatomic properties function

ReadWrite ReadOnly is the Set property access level.

Assgin is the direct assignment system default

Retain the class wants to hold properties all the time, the object property counter will add 1

Copy of the Copy object (when the property is NSString is a shallow copy of the object copy when the object is nsmutablestring deep copy when the object is)

Atomic nonatomic thread Access nonatomic is non-atomic access and is not synchronized.

4: The difference between a deep copy and a shallow copy .

A shallow copy is a pointer-copy object reference count plus 1 (such as a NSString object called copy is a shallow copy)

Deep copy copies a new object based on the original object (such as the Nsmutablestring object call copy is a deep copy)

How to manage memory in 5:oc

There are 2 kinds of first hand management mode of the second ARC automatic management.

Object-oriented in three OC

1: What is polymorphic

A pointer to a polymorphic subclass can point to the parent class, invoking the same method to implement different functions.

2: The role of the agent

The agent changes or controls the delivery chain. Allows a class to notify other classes under certain circumstances to complete a function (such as application startup completion that invokes the method of the Applicationdelegate class to monitor the application's life cycle)

3: Function of the categories (category)

the main role of the category is to dynamically extend new functions and methods for the class. (For example, if you use file caching in many places in your project, you can add a method to save the cache in NSObject for public convenience)

4: The difference between categories and extensions.

Same point:

Both categories and extensions can dynamically add new methods to the class.

Different points:

Class extensions can add properties, and the methods that the class extension declares must be implemented.

A category cannot be added to an attribute, which can be declared in a category that is not implemented.

does 5:object-c support multiple inheritance? Do you have private methods and private variables?

OBJECT-C does not support multiple inheritance, and multiple protocols can be used to implement multiple inheritance.

There are no private methods except class methods and instance methods.

6: Is it better to extend a class with a good inheritance or a category?

General use of the category is good, do not define subclasses can also directly put the definition of the class in different files (such as the method to extend the NSString the best use of the category)

7: When to use delegate? When do you use notification?

Delegate for object pair 1

Notification to a pair of more.

8: What does the @Prviate @protected @public statement mean?

@prviate private only accessible in this class

@protected protected, only accessible in this class and subclass

@public public any class can be accessed.

features in four OC :

What is the nature of the object declared by 1:id?

An ID declares an object that has a runtime attribute. A declaration object can point to any type of object in OC.

2: For NSString * str =[[nsdate alloc] init] object str compile-time and run-time type differences?

STR compiles when the NSString runtime is NSDate

The difference between 3:KVC and KVO

KVC Key-value encoding is a mechanism for indirectly accessing the properties of an object, indirectly through a string.

KVO key value observation model automatically responds to an object's specified method when the object property changes

4: What is the difference between the #import和 # include, what @class represent?

@class used to declare a class to resolve the same file with each other

#import is the keyword that OC introduces to the header file,

#include is the keyword for the introduction of the header file in the C language.

#include引入头文件可能引起重复编译 and #import does not cause duplicate compilation.

5: What are the differences between threads and processes?

The same point: threads and processes are the basic unit of operating system operation, the system uses this basic unit to implement the system's concurrency to the application.

Different points:

Process has a separate address space a process crash in protected mode does not affect other processes.

A thread is a process that executes a fragment path, the thread does not have a separate address space but has its own stack and local variables, and a thread crash equals the entire process dead. That is, multiple processes are better than multithreading robustness, but the system wastes many resources in the process of switching.

6: The difference between heap and stack?

Management method:

The variables on the stack are automatically managed by the compiler and do not need to be managed manually.

The variables on the heap are manually opened and released by the programmer.

7:id the difference between nil nil?

An ID is an attribute that declares that an object has run time. Can point to any type in the OC object.

Nil refers to an object with null pointers.

Nil points to the empty class.

8: @import <>, @import "" and the difference between @class

@class used to declare a class to resolve the same file with each other

@import <> used to import system header files

@import "" To import a custom header file

9: What is the difference between a method and a selector?

Selector (method) represents the method name

method is a combination that represents the name and implementation of the methods.

10: Your understanding of @property and @interface

@interface used to declare a class.

@property used to declare 2 methods The compiler automatically generates a Get set method.

Advantages and disadvantages of 11:OC language

Advantages:

1:category

2:c C + + OC mixed.

3: Dynamic identification

Disadvantages:

1: operator overloading not supported

2: Multiple inheritance is not supported.

V: IOS life cycle

1:viewcontroller Loadview, Viewdidload, viewdidunload when were they called?

Loadview is called when Self.view=nil calls the Loadview method

Viewdidload is the method that is called when view loading is complete.

Viewdidunload is called after the view controller is destroyed on the window.

2: There are several ways the application is opened

1: Normal Open

2: Local Notifications Open Program

3: Opened by another program call (program can be turned on)

Six iOS in the UI section

the difference between 1:frame and bounds?

Frame is the location of the child view's coordinates relative to the view.

Bounds is its own coordinate system (where x =0 y=0)

The difference between 2:uiview and Calayer?

UIView is the basic interface base for iOS all interface elements are based on UIView, and the drawing portion within UIView is done by layers.

3: Event handling Process

When the user touches the point of view to see if there are Subview and Subview on the Subview.

If both events are present, the current view is processed.

If the subview on the subview is not present simultaneously, the touch point is handled by a recent subview.

4; Event Processing termination conditions

Alphe <0.01

Userinteractionenabled=no

Hidden ==yes

What is the life cycle of 5:uiview? What the order is.

Create VIEW and Render view

Init--Loadview--viewdidload--viewwillappear--viewdidappear

The disappearance and destruction of view

Viewwilldisappear--viewdiddisappear--viewunload--dealloc

6:uiviewcontroller when the view is loaded back.

When calling Self.view =nil, Loadview is called to reload the view.

What is the flow of proxy method execution in 7:uitableview?

First step: Get section--Numberofsectiontableview

Step two: Get row--Numberofrowtableview

Step three: Create a cell-—— method forgot.

How to use cell reuse in 8:uitaleview.

The 1:uitableview object first flushes the cache out of the cell

2: Remove the cell and recreate it if nil

3: The retrieved cell is re-assigned if it is not nil.

9: How to design a variable-height cell?

1: Get content to calculate the height of content by content

2: In the UITableView set the cell proxy method to calculate the height of the assigned value.

10: Talk about using MVC mode in UITableView.

MVC pattern

M represents the data model primarily for data sources.

The V represents the view model primarily for displaying the interface.

C represents the controller is mainly a bridge between the data model and the view model.

Seven: Data storage for iOS

1:ios is the way to store data sources.

File storage (file cache),

Plist,

Nsuserdefault (used to store passwords)

Sqlit (Product information)

3: Database Optimization Experience

1: Bulk operations to be done in a database connection

2: Multiple operations to open things

3: Query to turn on paged query.

Eight: Network and Threads in iOS

1: Security handling of network requests.

A: A POST request is used in a general request, and the parameters of the POST request are BASE64 encoded.

Common Threads in 2:ios

Queue (Operationqueue) creates a task to add a task to the Task force opens an asynchronous thread.

GCD operation

3: What is a TCP three-time handshake

First handshake: The client sends a request to the server to wait for service acknowledgement

Second handshake: The service handles the client's request.

Third handshake: The server responds to the client with the processed request.

4:socket establishing a network connection step

1: Client request: The client makes a request through the socket to the specified IP port protocol.

2: Server-Side monitoring: service-side sockets real-time monitoring network requests waiting for client requests.

3: Connection confirmation: When the service side hears the client sends over the socket and processes the response to the client.

Nine: iOS Other operations

1:ios message push mechanism

A: ①: The app sends the message and iphone logo package to the Apple push server

②: Apple servers look for packaged iphone identities and send messages

③:iphone send a message to the corresponding program popup push notification

Ten: Problems with iOS development

1: Multiple controllers are repeatedly created by clicking the navigation button multiple times in succession?

Solution: In the Click button to add a bool value, if a click directly create VC, the 2nd click does not do the creation of VC

iOS Interview 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.