iOS Interview Tips

Source: Internet
Author: User
Tags notification center

First, the software development process?

the general process of software design ideas and methods, including the design software functions and the implementation of the algorithm and method, the overall structure of the software design and module design, programming and debugging, program-linked harmonic testing and writing, submitting programs.

1 The relevant system analysts and users to understand the requirements, and then use Word to list the system to develop the large functional modules, each large function module has a small function module, for some needs more clearly related interface, in this step can be a preliminary definition of a small number of interfaces.

2 system analyst in-depth understanding and analysis of requirements, according to their own experience and needs to use Word or related tools to make a document system functional requirements document. This document will be clear examples of the system of large functional modules, large functional modules have small functional modules, and also examples of related interface and interface functions.

3 System analysts and users confirm the requirements again.

4 The system analyst makes a systematic summary design of each interface or function in an iterative manner according to the interface and functional requirements of the identified requirements document.

5 The System analyst writes a well-written summary design document to the programmer, which is written by the programmer according to the function of the example.

6 test the system written well. To be used by the user, the user uses the following one to confirm each function and then acceptance.

As an example:

1 A company wants to find someone to make a set of personnel management software, from some channels to know that we have provided this service, so contact us.

2 we will send a dedicated software engineer to them to understand what we are going to design a thing for them to use, and then come back and make a plan for them, and the content of the program includes: What is the approximate interface of the software we developed? What is convenient for people to use? What features can anyone use? To what extent is it convenient? What are the approximate hardware requirements? (This piece is about where the demand is obtained, it is not necessary to say that it is so complicated, just say the product manager from the customer to obtain product requirements)

3 after they looked at the program, they decided that they were going to do a set of such software, and I started developing it.

4 We put the developed software to use them, where the use of the process where the use of inconvenient or where not to achieve the requirements, we will first modify these features, until they require all the functions can be perfectly resolved.

Second, the project process?

Projects--demand analysis--overall design--detailed design--development programming--Test analysis and system integration-->

1. Demand Analysis: through the understanding of the customer's business and the customer's discussion of the process to the basic modeling of requirements, the final formation of the requirements specification.

2. Overall Design: through the analysis of demand information, the external conditions of the system and internal business requirements of the abstract modeling, the final form of summary design documentation.

3. Detailed design: This section provides a detailed system design based on the requirements and outline design (also includes some code descriptions).

4. Development Programming: Coding the system.

5. test Analysis and System integration: Perform simulation data testing and other relevance testing on all functional modules and integrate all module functions.

6. On- site support: system on-line test run on-site problem record, answer.

7. System Operation support: The system is formally pushed postpartum, the system to make necessary maintenance and bug modification

Third, the app released the listing process?

(1) In the developer center of the Apple website, create a new app to fill in some descriptive information about this app

(2) Download the installation release certificate

(3) Select Publish certificate, compile the package with archive

(4) Submit a release package using Xcode

First, certificate export

Need an Apple developer account, http://developer.apple.com

Apply AppID

Apply for publishing certificate (p12 format)

Generate Provisioning File

Second, Appcan.on online IPA package compilation

Third, the IPA package submitted Apple AppStore

Iv. algorithm: Recursive, bubble sort, select sort?

Bubble sort: (brief idea and usage)

Thoughts: 22 Compare the keywords for the sorted record, and find that the two records are exchanged in reverse order until there are no reversed records (compared from the first number)

Ina[9] = {12,32,43,23,45,23,12,56,78};

int index2 = 0;

for (int index1 = 0; index1<9; index1++) {
Take out the number of (n+1) to compare with the former

Compare the first round and put the biggest number on top, just like a bubble

for (index2 = index1+1; index2<9; index2++) {

int variable = 0;

if (A[index1]<a[index2]) {

variable = a[index1];

A[INDEX1] = A[index2];

A[INDEX2] = variable;

}

}

}

Insert Sort

Thought: To find the insertion position in an already sorted sequence by using the sequential method, locate the original record in that position, and then move it back to a position where you want to insert the new record. (traversing left-to-right in an already-lined sequence, finding the previous number is greater than the last number, setting the latter to the Save value temp, starting with the previous subscript of the saved value temp and the preceding number with the Save value temp, if this number is greater than the save value, assign the number to the latter number, Empty the number and continue the comparison until it is smaller than the saved value, then assign the temp value to the latter number. )

int i,j;

for (int i=0;i<9;i++) {

if (A[i]<a[i-1]) {

int temp = a[i];//Small value found

for (int j=i-1; j>=0&&a[j]<temp; j--) {//The previous number is compared to this small value, if it is larger then the position is moved back.

A[J+1] = A[j];

}

A[J+1] = temp;

}

}

Recursive

The algorithm that can use recursive description usually has this characteristic: in order to solve the problem of scale N, we try to decompose it into smaller problem, then we can construct the solution of big problem conveniently from the solution of these small problems, and these smaller problems could be decomposed into smaller problems by using the same decomposition and synthesis method. And the solution of the larger problem is constructed from the solution of these smaller problems. In particular, when scale is n=1, it can be solved directly.

For example:

"Problem" writes the nth function fib (n) that computes the Fibonacci (Fibonacci) sequence.

The Fibonacci sequence is: 0, 1, 1, 2, 3 、......, i.e.:

FIB (0) = 0;

FIB (1) = 1;

FIB (n) =fib (n-1) +fib (n-2) (when n>1).

A recursive function is written as follows:

int fib (int n) {

if (n==0) return 0;

if (n==1) return 1;

if (n>1) return fib (n-1) +fib (n-2);

}

Recursion and regression are two stages in the execution of recursive algorithm. In the recursive phase, the solution of the more complex problem (size n) is solved by the problem that is simpler than the original problem (the size is less than n). For example, in the example above, solve FIB (n) and push it to solve FIB (n-1) and fib (n-2). That is, in order to calculate FIB (n), the FIB (n-1) and fib (n-2) must be computed, while the FIB (n-1) and fib (n-2) must be computed, and then the (n-3) and fib (n-4) should be calculated first. And so on, until the FIB (1) and fib (0) are calculated, respectively, the results 1 and 0 can be obtained immediately. In the recursive phase, there must be a case for terminating the recursion. For example, in a function fib, when n is 1 and 0.

In the regression phase, when the solution of the simplest case is obtained, the solution of the slightly complex problem is obtained, such as the FIB (1) and fib (0), and the results of the FIB (2) are returned. After the results of FIB (n-1) and fib (n-2) are obtained, the results of FIB (n) are returned.

When writing a recursive function, it is important to note that local variables and parameter knowledge in functions are limited to the current call layer, and when recursion is pushed into the "simple problem" layer, the original level parameters and local variables are concealed. In a series of "simple problem" layers, they each have their own parameters and local variables.

Because recursion causes a series of function calls, and there may be a series of repeated computations, the execution efficiency of the recursive algorithm is relatively low. When a recursive algorithm can be easily converted into recursive method, the program is usually programmed by recursive method. For example, the function fib (n), which computes the nth term of the Fibonacci sequence, should use a recursive algorithm that starts with the first two entries of the Fibonacci sequence and calculates the next item from the first two successive entries until the nth item of the requirement is calculated.

Five, several common design patterns:

MVC, delegate (proxy) anonymous functions/closures, observers (notifications, KVO), Singleton

MVC: Data passed by the model is displayed on the interface

Application scenario: is a very old design pattern, through the data model, controller logic, view shows the application is logically divided.

Advantages: Make the system, clear level, responsibility clear, easy to maintain

Agile principles: Open to extensions-closed for modifications

Example: model-is the data model, view-view display, Controller for UI presentation and data interaction logic control.

1, what is MVC, why use MVC, what are the benefits?

A: Model, view, and control controller, respectively.

The model data model is used to encapsulate data related to the business logic of the application and how to handle the data.

"Model" has the right to direct data access, such as access to the database.

The View view layer enables the data to be displayed with purpose.

Controller controllers play an organizational role across different levels to control the flow of applications.

2. Describe how to implement the MVC development model in the iOS SDK

A: MVC is: Model-view-control development mode, for iOS SDK, all views are view layer, it should be independent of the model layer, controlled by the view control layer. All user data is the model layer and should be independent of the view. All Viewcontroller are control layers, which are responsible for controlling views, accessing model data

Delegate (agent)

Scenario: When some functionality of a class needs to be implemented by another class, it is not certain which class implementation is specific.

Advantages: Decoupling

Agile principle: open-closed principle

Viewer (notification, KVO)

Application scenario: Generally the model layer pair, controller and view of the notification method, do not care who to receive, only responsible for publishing information.

Advantages: Decoupling

Agile principles: Interface Isolation principle, open-closed principle

Example: Notification Notification Center, Registration Notification Center, any location can send a message, registered observer object can be received.

KVO, the key value to change the notice of the observer, usually basically useless.

Notice:

Send notification:

[[Nsnotificationcenter Defaultcenter] postnotificationname: Notification Name object: information supplied];

Accept notification (Viewer):

[[Nsnotificationcenter Defaultcenter] Addobserver: Registered Observer selector: What to do when the supervisor hears the message name: Notification Name object:];

KVO:

The use of KVO mainly involves 3 parts:

1. register the observer for the object's properties : Object by calling this method to add an observer to the property

Object-c Code

    • -(void) Addobserver: (NSOBJECT *) Observer
    • Forkeypath: (NSString *) keypath
    • Options: (nskeyvalueobservingoptions) options
    • Context: (void *) context

    • Observer: Viewer object. It must implement method ObserveValueForKeyPath:ofObject:change:context:.
    • KeyPath: The observed attribute, which cannot be nil.
    • Options: Sets the value of the attribute passed when the observer is notified, whether it is the nskeyvalueobservingoptionold before the change, or the nskeyvalueobservingoptionnew after the change.
    • Context: Some other contextual information that needs to be passed to the observer, usually set to nil

2. The observer receives the notification and makes the processing: The observer completes the response to the property change by implementing the following method:

Object-c Code

    • -(void) Observevalueforkeypath: (NSString *) keypath
    • Ofobject: (ID) object
    • Change: (nsdictionary *) change
    • Context: (void *) context
    • KeyPath: The observed attribute, which cannot be nil.
    • Object: Objects to be observed.
    • Change: attribute value, based on the options set above, gives the corresponding attribute value
    • Context: The context object passed above.

3. clear the Observer : The object removes the Observer by this method:

Object-c Code

    • -(void) Removeobserver: (NSObject *) anobserver Forkeypath: (NSString *) keypath

Single case

Application scenario: Ensure that a program runs in a class that has only one instance for resource sharing control.

Advantages: Easy to use, time-delay evaluation, ease of cross-module

Agile principles: a single responsibility principle

For example:

Declare a shared instance method in. h

+ (instancetype) sharedinstance;

in the . M inside

+ (instancetype) sharedinstance {

staticviewcontroller *sharedinstance = nil;

//GCD Implementation of a single case

staticdispatch_once_t oncetoken;

dispatch_once(&oncetoken, ^{

///Alloc Method allocates memory control, single case guaranteed only alloc once

sharedinstance = [[selfalloc] init];

});

return sharedinstance;

}

Vi. categories, extensions, agreements

Category (category)

The class is to add a new method to a class that already exists.

However, you cannot add an instance variable.

What are the usage scenarios for category:

1, the class contains a number of method implementations, and these methods require different team members to implement

2. When you are working with classes in the base Class library, you do not want to inherit these classes and only want to add some methods.

Category can achieve the above requirements, of course, there are also the use of category is to pay attention to the problem:

1. Category can access an instance variable of the original class, but cannot add an instance variable, if you want to add a variable, it is implemented by inheriting to create a subclass.

2, category can overload the method of the original class, it is not recommended to do so, this will overwrite the original class method. If you do want to overload it, it is implemented by inheriting the subclass.

3, and the common interface is different, in the category implementation of the file instance method as long as you do not call it you can not implement all the methods of the Declaration.

Extension: In the class implementation file. m defines a class called an extension.

Define your own private methods

Protocol (PROTOCOL)

The protocol declares a method that can be implemented by other classes, and the protocol itself is not implemented.

A protocol is not a class, but an interface that other objects can implement.

The protocol can be written in a class, when used to introduce the class header file.

@requried: Methods that must be implemented

@optional: An optional Implementation method

Definition: @protocol protocol name//(optional Write) < extended protocol name (ex: NSObject) >

@end

One protocol can be extended from another protocol.

iOS Interview Tips

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.