iOS face five questions

Source: Internet
Author: User

1.doesobjective-c have a private method? What about private variables? If not, is there any alternative?

the methods in Objective-c are divided into: static methods and instance methods

There are no private methods, there are private variables, all instances become The amount is private by default , All instance methods are public by default

private methods can be used category and the extension to replace


2. What is the difference between #import,#include and @class ?

@class is typically used when you need to declare an instance variable of the class in a header file , it simply declares a class name , The internal implementation of this class has not been told to the compiler , in m files still need to use the #import. and #import's advantage over #include is that it doesn't cause cross-compilation.


3. talk about you. mvc mvc cocoa mvc How did it come true? Are you also familiar with other oc design patterns or other design patterns?

MVC is that Model-view-controller the abbreviation , M refers to a business model , V refers to the user page , C refers to a controller. MVC is an architectural pattern , which is the separation of code between M and V , so that the same program can use a different form of expression. M: represents data and business rules , V is the page that the user sees and interacts with , and C is the user's input and calls M and V Take the user's needs.

Singleton mode, Delegate mode, KVC mode, message notification mode, target/action Mode


4. How to monitor the system keyboard pop-up?

uikeyboarddidshownotification (keyboard popup notification)

uikeyboardwillhidenotification (keyboard disappears notification)


[[Nsnotificationcenter defaultcenter]addobserver: self selector:@selector () Name:uikeyboardwillshownotification object:nil];


5. give more than 5 of the IOS SDK libraries You are familiar with and what are the third-party libraries?

Afnetworking,sdwebimage,sharesdk,mjrefresh,fmdb,mbprogresshud


6. How do I publish a product in multiple languages?

in the engineering infoplist.strings to add the language that you want to publish in the Info.plist to add a new property in the application has localized display name set Type to Boolean and Will value set to YES, Create ". Strings" file to String Multi-lingual processing of pictures and other files


7. How do I turn a sensitive word into a * *?

 //  accessing arrays of sensitive words     NSMutableArray *array = [[NSMutableArray  alloc]init];    //  add elements to the sensitive word group     nsstring *element1 =  @ "Sensitive word";     nsstring *element2 = @ "Me";     [array  addobject:element1];    [array addobject:element2];    //   The string to judge     nsmutablestring *str = [[nsmutablestring alloc] initwithstring:@ "I am the Sensitive word"];    for  (int i = 0; i <  array.count; i++)  {        //  sensitive word substitution strings          NSMutableString *replaceString = [[NSMutableString  alloc]init];        //  determines whether a string contains the specified string, returns the position and length          nsrange range = [str rangeofstring:array[i]];        for   (int j = 0; j<range.length; j++)  {             [replacestring appendstring:@ "*"];         }        //  a range with characters instead of          [str replaceCharactersInRange:range withString:replaceString];     }    nslog (@ "%@", str);


8. What does the minus sign and the plus sign in OBJC mean?

Front plus (+) method for the class method This type of method can be called directly with the class name. Its role is to create an instance that someone calls a factory method of creating an instance

Front minus (-) method is an instance method, you must use an instance of the class to invoke the


9. What is the purpose of the single case?

Purpose: Encapsulate a shared resource provides a fixed instance creation method that provides a standard instance access interface that saves memory.


Ten , Talk about the response chain

The first thing to be clear is: IOS , the responder chain responds to the event, and all the response classes are Uiresponder , the responder chain is a hierarchy of different objects, each of which gets an opportunity to respond to an event message in turn.


The process of the responder chain:

When an event occurs, the response chain is first sent to the first responder ( Often the view where the event occurs, i.e. where the user touches the screen ) The event is passed along the responder chain until it is accepted and processed. In general, the first response is the view object or its subclass, when it is touched after the event is processed, if it is not processed, the event will be passed to the view controller Uiviewcontroller(if present) and then its parent view, And so on until the top-level view. Next, follow the top viewto the window (uiwidow object) to the program's uiapplication Object , the event is discarded if the entire procedure does not respond to the event. In general, events are passed in the responder chain as long as there is an object handling event.


This article is from the "http://fanyuecheng.blog.51cto.com/9529438/1686180 blog" blog, please make sure to keep this source.

iOS face five questions

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.