iOS face questions

Source: Internet
Author: User
Tags md5 encryption php server

    • Premise: This article is for the students who have less experience in the interview.
      First of all, talk about the preparation before the interview, divided into two aspects;
      -: Widely read the interview topics, find out the key topics, in advance to remember the answer. Many people think that they do a few projects, usually also have serious study, disdain to cram, this is wrong, a lot of things you know to the interview will be due to psychological pressure, and let you not clear, the interviewer listen to the indefinitely, the results are self-evident, extensive reading also let you look at the interview wide, ease.
      Second: The top priority, resume writing, a good resume to let you in the other person's mouth, the impression points on more than 20 points. The CV is divided into three aspects: (1) personal information (2) Personal skills (3) project experience; Finally, add a bit of personal evaluation (one or two words can be, write a "strong adaptability, self-learning ability" universal. Do not write a large pile. )
      Here are two good templates: http://wenku.baidu.com/user/contribution?st=1
    • 2
      OK, let's get the work done. Start a mock interview (the topic comes from my own experience).
      The core idea of the interview: to guide the interviewer (experience in the process, concluding summary). Etiquette, dress I will not say, everyone is an adult.
      Generally speaking, if you are interviewing with several people, do not do the first one, the reason is very simple, you see "I am a Singer" you understand. After interviewing several people, the first person's impression will be reduced, if the a,b,c ability is similar, b,c success rate is higher than a, another important reason is that the latter usually will be asked to a not answer good questions, if you can answer well, stand up. As for the answer is not good, the interviewer also think you one level.
      Question 1: What is object-oriented.
      Cut in: The interviewer is not the answer itself, but your logical expression, understanding, and application.
      A: Object-oriented is different from the process-oriented, the process can be expressed as: program = algorithm + data structure, object-oriented can be expressed as Program = object + message.
      Object-oriented is to simulate the way of thinking of human habits as much as possible, so as to make the method and process of developing software as close as possible to human understanding of world problem solving methods and processes. We emphasize that "all things are objects", and we abstract their attributes and behaviors, and show them in the form of code. It has three basic features
      1.Package:
      encapsulation is to hide the internal implementation, only provide interface methods to access. For example, we callNSStringclass, interception, splicing method, we do not need a specific algorithm, but only call the corresponding method.
      2. Inheritance:
      It is a relationship between two classes in an object-oriented program, that is, a class can inherit state and behavior from another class (that is, its parent class). The class that inherits the parent class is called a subclass.
      The superiority of inheritance: by using inheritance, programmers can reuse the code in the parent class several times in different subclasses, make the program structure clear, easy to maintain and modify, and the subclass can provide some special behavior, these special behaviors are not in the parent class.
      3. Polymorphism:
      Refers to the coexistence of the same name method in a program, the caller only need to use the same method name, the system will invoke the corresponding different methods according to different circumstances, so as to achieve different functions. Polymorphism is also known as "a name, multiple methods."

      The above operation is to achieve code reuse, implementation of code portability, flexibility, and low-coupling, high cohesion.
      A problem actually wrote so much ...
    • 3
      Question 2: A brief introduction of your project (here is the start of the Guide interview officer, if he does not ask this question, you put yourself, you have to know that the interviewer is actually nervous, he does not know what you will, it may know more, but also have the feeling of not knowing, you hand a pillow, he will definitely answer. )
      Answer: (Choose your own answer, for example) I used the custom cell display data, using the three-party framework afnetworking,asihttprequest, access the network, get jason,xml format data, and then do some data parsing, local storage, Also useful for XMPP implementation of instant Chat, in the local with proxy, notify, block to communicate between classes, and implanted a map, implemented pull-up loading, drop-down refresh function .....
      See, the interview is out of the question.
      1. Talk about the reuse of Tableviewcell (emphasis)
      This refers to its reuse mechanism, first understand why to reuse, without him: efficiency, memory.
      Viewing the UITableView header file, you will find nsmutablearray* visiablecells, and nsmutabledictnery* reusabletablecells two structures. Save the cells,reusabletablecells cells that are currently displayed in Visiablecells.
      At the beginning of TableView display, Reusabletablecells is empty, then TableView Dequeuereusablecellwithidentifier:cellidentifier returns nil. The starting cell is created by [[UITableViewCell alloc] Initwithstyle:uitableviewcellstyledefault Reuseidentifier:cellidentifier], And Cellforrowatindexpath just calls the maximum number of cells to display.
      For example: There are 100 data, iphone one screen display up to 10 cells. The scenario at which the program initially shows TableView is:
      1. Create 10 cells with [[UITableViewCell alloc] Initwithstyle:uitableviewcellstyledefault Reuseidentifier:cellidentifier], and assign the same reuse identity to the cell (of course, you can specify different identities for cells of different display types). And all 10 cells are added to the Visiablecells array, and the Reusabletablecells is empty.
      2. Drag the TableView down, when Cell1 completely out of the screen, and CELL11 (it is also alloc out, the reason above) is fully displayed. Cell11 joins to Visiablecells,cell1 to move out visiablecells,cell1 to join to Reusabletablecells.
      3. Then drag the TableView down, because there are already values in the reusabletablecells, so when it is necessary to show that the new Cell,cellforrowatindexpath is called again, TableView Dequeuereusablecellwithidentifier:cellidentifier, return to CELL1. Cell1 joins the VISIABLECELLS,CELL1 to move out of the reusabletablecells;cell2 to move out visiablecells,cell2 join to Reusabletablecells. Cells that need to be displayed later can be reused normally.

      2. Tell me how to customize cell row height based on content
      Previously used three-party Rtlabel (non-arc,int,nsinteger and other problems, the method is too old, the version is not new, to discard)
      The method in IOS6, deprecated in iOS7.
      /* Cgsize textSize = [Textarray sizewithfont:[uifont systemfontofsize:16.0] Constrainedtosize:cgsizemake (280, 100000000) linebreakmode:nslinebreakbywordwrapping];*/
      Define a dictionary that can also put other properties, not just the font size
      Nsdictionary *attribute = @{nsfontattributename: [Uifont systemfontofsize:15.0]};
      The method of calculating text size provided in iOS7 cgsize textSize1 = [Textarray boundingRectWithSize:tableView.bounds.size options:     Nsstringdrawinguseslinefragmentorigin | Nsstringdrawingtruncateslastvisibleline Attributes:attribute context:nil].size;
      NSLog (@ "%f", textsize1.height);

      3. Talk about Afnetworking,asihttprequest
      The difference between 3.json and XML (emphasis)
      The underlying display is different, such as Jason using {} to represent the dictionary [] array
    • JSON with the XML Comparison of the differences
    • 1. Definition Introduction
    • (1). XML definition
    • The Extensible Markup Language (extensible Markup Language, XML), which is used to tag electronic files with a structured markup language that can be used to tag data, define data types, is a source language that allows users to define their own markup language. XML uses the DTD (document type definition) document type definition to organize the data, a unified format, cross-platform and language, and has long been recognized as a standard in the industry.
    • XML is a subset of standard Generalized Markup Language (SGML) and is ideal for Web transport. XML provides a unified approach to describing and exchanging structured data that is independent of the application or vendor.
    • (2). JSON definition
    • JSON (JavaScript Object Notation) is a lightweight data interchange format with good readability and easy-to-write features. Data exchange between different platforms is possible. JSON uses a very high compatibility, completely independent of the language text format, but also has a similar to the C language habits (including C, C + +, C #, Java, JavaScript, Perl, Python, etc.) the behavior of the system. These features make JSON an ideal data exchange language.
    • JSON is based on JavaScript programming Language, Standard ECMA-262 a subset of 3rd Edition-december 1999.
    • Pros and cons of 2.XML and JSON
    • (1). Advantages and disadvantages of XML
    • <1>. Advantages of XML
    • A. Uniform format, in line with the standards;
    • B. Easy to interact with other systems remotely, data sharing is more convenient.
    • <2>. Disadvantages of XML
    • A.xml file is large, the file format is complex, the transmission occupies the bandwidth;
    • B. Both the server side and the client need to spend a lot of code to parse the XML, causing the server and client code to become unusually complex and difficult to maintain;
    • C. The way the client parses XML between different browsers is inconsistent, and many code needs to be written repeatedly;
    • D. The server side and client parsing XML spend more resources and time.
    • (2). The pros and cons of JSON
    • <1>. The advantages of JSON:
    • A. Data format is relatively simple, easy to read and write, the format is compressed, occupy small bandwidth;
    • B. Easy to parse, client-side JavaScript can simply pass the eval () to the JSON data read;
    • C. Support multiple languages, including ActionScript, C, C #, ColdFusion, Java, JavaScript, Perl, PHP, Python, Ruby and other server-side language, convenient for server-side analysis;
    • D. In the world of PHP, there are already Php-json and json-php appear, partial to the PHP serialization of the program directly call, PHP server-side objects, arrays, etc. can be directly generated JSON format, convenient for client access extraction;
    • E. Because the JSON format can be used directly for server-side code, greatly simplifies the server-side and client code development, and the completion of the task is not changed, and easy to maintain.
    • <2>. The drawbacks of JSON
    • A. There is no XML format so popular and happy to use widely, without XML so universal;
    • The B.json format is now in the initial stage of promotion in Web service.
    • Comparison of the pros and cons of 3.XML and JSON
    • (1). Readability.
    • JSON and XML are basically the same readability of data, JSON and XML are comparable in readability, while the proposed syntax, one side of the canonical label form, XML readability.
    • (2). Extensibility aspects.
    • XML is inherently well-extensible, and JSON, of course, has nothing to do with XML extension, not JSON.
    • (3). Coding difficulty.
    • XML has a wealth of coding tools, such as dom4j, Jdom, and so on, JSON also has json.org provided tools, but JSON is much easier to encode than XML, even if the use of tools can write JSON code, but to write good XML is not easy.
    • (4). Decoding difficulty.
    • Parsing the XML takes into account the child node parent, which makes the person dizzy, and the JSON is almost 0 difficult to parse. This is a little bit of XML output.
    • (5). degree of popularity.
    • XML has been widely used in the industry, and JSON has only just begun, but in the specific area of Ajax, the future development must be XML to be located in JSON. Ajax should become Ajaj (asynchronous Javascript and JSON).
    • (6). Analytical means.
    • JSON and XML also have rich parsing tools.
    • (7). Data volume aspect.
    • JSON, with respect to XML, has a small volume of data and is faster to pass.
    • (8). Data interaction aspects.
    • The interaction between JSON and JavaScript is more convenient, easier to parse, and better to interact with the data.
    • (9). Data description aspects.
    • JSON is less descriptive of the data than XML.
    • (10). Transmission speed.
    • JSON is much faster than XML.
    • 4.XML comparison with JSON data format
    • (1). About lightweight and heavyweight
    • Lightweight and heavyweight are relative, so what is the weight of XML relative to JSON? should be reflected in the parsing, XML is currently designed two ways of parsing: Dom and SAX.
    • <1>. Dom
    • Dom is a data Interchange Format XML as a DOM object, you need to read the entire XML file into memory, which is the same as the principle of JSON and XML, but the XML to consider the parent node and child nodes, which is much less difficult to parse JSON, Because JSON is built on two structures: Key/value, a set of key-value pairs, an ordered set of values that can be understood as an array;
    • <2>. Sax
    • Sax does not require the entire document to be read into the parsed content can be processed, is a stepwise analysis of the method. The program can also terminate parsing at any time. In this way, a large document can be gradually and 1.1 points, so sax is suitable for large-scale parsing. At this point, JSON is not available at this time.
    • So, the difference between the light/weight levels of JSON and XML is:
    • JSON only provides a holistic parsing scheme, and this method only has a good effect when parsing less data;
    • XML provides a stepwise parsing scheme for large-scale data, which is well suited for processing large amounts of data.
    • (2). About data format coding and parsing difficulty
    • <1>: In terms of coding.
    • Although both XML and JSON have their own coding tools, JSON is much simpler to encode than XML, and it can be written out without tools, but it's a bit difficult to write good XML code, and JSON is text-based, like XML, and they all use Unicode encoding. And it is as readable as the data Interchange Format XML.
    • Subjectively, JSON is clearer and less redundant. The JSON Web site provides a strict description of the JSON syntax, just a short description. In general, XML is more appropriate for tagging documents, while JSON is more suitable for data interchange processing.
    • <2>: In terms of parsing.
    • In common Web applications, developers often have trouble parsing XML, whether it is server-side generation or processing of XML, or client parsing XML with JavaScript, often leading to complex code, very low development efficiency.
    • In fact, for most Web applications, they don't need complex XML to transfer data at all, and XML claims are rarely advantageous in terms of extensibility, and many AJAX applications even return HTML fragments directly to build dynamic Web pages. Returning HTML fragments greatly reduces the complexity of the system compared to returning XML and parsing it, but at the same time lacks some flexibility. The Data Interchange Format JSON provides greater simplicity and flexibility than XML or HTML fragments. In Web Serivice applications, at least for now, XML still has an unshakable position.

    • 4. How local data is stored and what methods are used (emphasis)
      Coredata,nsuserdefaultcenter, database, writing file
    • 1.NSKeyedArchiver: Save the data in the form of an archive that requires adherence to the Nscoding protocol, and that the class corresponding to the object must provide Encodewithcoder: and Initwithcoder: Methods. The previous method tells the system how to encode the object, and the latter method tells the system how to decode the object. For example, save the Possession object archive.
    • Define possession:
    • @interfacePossession: nsobject{//compliance with nscoding Agreement
    • NSString *name; Pending archive Type
    • }
    • @implementation Possession
    • -(void) Encodewithcoder: (Nscoder *) acoder{
    • [acoderencodeobject:nameforkey:@ "name"]; }
    • -(void) Initwithcoder: (Nscoder *) adecoder{
    • Name=[adecoder decodeobjectforkey:@ "name"] retain];
    • }
    • Archive operation: If you save the possession object Allpossession archive, you only need to nscoder the method Archiverootobject:tofile of the subclass Nskeyedarchiver: Yes.
    • NSString *path =[selfpossessionarchivepath];
    • [Nskeyedarchiver archiverootobject:allpossessions Tofile:path]
    • Decompression operation: Also call Nscoder subclass Nskeyedarchiver Method Unarchiverootobject:tofile: Can allpossessions = [Nskeyedunarchiverunarchiveobjectwithfile:path] retain];
    • Cons: Archive the form to save data, only one-time archive save and one-time decompression. So only a small amount of data, and the data operation is clumsy, that is, if you want to change a small part of the data, still need to extract the entire data or archive the entire data.
    • 2.NSUserDefaults: Used to save application settings and properties, user-saved data. The data still exists after the user opens the program again or after powering it on. The types of data that Nsuserdefaults can store include: NSData, NSString, NSNumber, NSDate, Nsarray, Nsdictionary. If you want to store other types, you need to convert to the previous type to use Nsuserdefaults storage. The specific implementation is:
    • Save data:
    • Nsuserdefaults *defaults=[nsuserdefaultsstandarduserdefaults];
    • NSString *name [email protected] "default string";
    • [Defaults setobject:firstname forkey:@ "name"];
    • Get UIImage instances
    • UIImage *image=[uiimage alloc]initwithcontentsoffile:@ "Photo.jpg"];
    • NSData *imagedata = uiimagejpegrepresentation (image),//uiimage object converted to NSData [defaults
    • synchronize];//using synchronize method to persist data to standarduserdefaults database
    • Read data:
    • Nsuserdefaults *defaults=[nsuserdefaultsstandarduserdefaults];
    • NSString *name = [Defaults objectforkey:@ "name"];//Remove name based on key value
    • NSData *imagedata = [Defaults dataforkey:@ "image"];
    • UIImage *image = [UIImage imagewithdata:imagedata];//nsdata converted to UIImage
    • 3. Write writes: Permanently saved on disk. The specific methods are:
    • Step one: Get the path that the file is about to save:
    • Nsarray*documentpaths=nssearchpathfordirectoriesindomains (Nsdocumentdirectory,nsuserdomainmask,yes);// Use the C function nssearchpathfordirectoriesindomains to get the full path of the directory in the sandbox. The function has three parameters, a directory type, a he domain mask, and a Boolean value. Where the Boolean value indicates whether you need to extend the path through the? ~. And the first parameter is constant, which is nssearchpathdirectory. In iOS, the latter two parameters are the same: Nsuserdomainmask and yes.
    • NSString *ourdocumentpath =[documentpaths objectatindex:0];
    • Another way is to use the Nshomedirectory function to get the sandbox path. The specific usage is:
    • NSString *sandboxpath = Nshomedirectory ();
    • Once you are having the Fullsandbox path, you can create a path from it, but you cannot write a file on the layer of this file on the sandbox or create a directory, but this should be based on creating a new writable directory, such as do Cuments,library or temp. NSString *documentpath = [Sandboxpath
    • stringbyappendingpathcomponent:@ "Documents"];//to add documents to the sandbox path, the specific reason before the analysis!
    • The difference between the two is that using Nssearchpathfordirectoriesindomains is more secure than adding a document behind Nshomedirectory. Because the file directory may change on future systems that are sent.
    • Step two: Generate files under this path:
    • NSString *filename=[documentdirectorystringbyappendingpathcomponent:filename];//filename is the file name of the saved files
    • Step three: Write data to the file:
    • [datawritetofile:filenameatomically:yes];//writes NSData type Object data to a file named filename
    • Finally: Read the data from the file:
    • Nsdatadata=[nsdatadatawithcontentsoffile:filename options:0 error:null];//read out data from FileName

    • Understanding of 5.XMPP

    • 6. The difference between agent, notification, and block (emphasis)
      The purpose of the agent is to change or transfer the control chain. Allows a class to be notified to other classes at certain times without having to obtain pointers to those classes. Can reduce the complexity of the frame. On the other hand, a proxy can be understood as a similarity to the callback listener mechanism in Java.
      Agent notification differences, the agent is usually one-to, need to return data, notification one-to-many, do not need to return data, block is iOS4 later use, convenient, but the format is weird.
      7. Talk about the implementation of the pull-down refresh
      8. What map did you use?
      9. Use the database, and delete and change the keywords (emphasis)
      10. Have you ever defined a control key?
      11.viewcontroller life cycle (Focus)
      12. Network security issues (emphasis)
      From Get post, talk about data MD5 encryption, protocol security, source code security
      13. Database Security Issues
      14. Multithreading Issues
      15. Data structure, stack problems
      16. Circular References
      17. Threads, Processes
      17. Last Arc non-arc, auto-release pool (focus)
    • 4
      These problems are not difficult, the Internet is a search a lot, we look at the control.
      Or that sentence, the answer pupils can recite, important is to express, must be logical clear, answer questions should not only answer the question itself, should make appropriate extension, revealing your wide range of knowledge.
    • 5
      Finally, it's time to test the emotional quotient.
      Question one: Where do you live?
      This is not closer to you! This is to consider the stability of your work, if local is good answer! "I will live in XXXX". What to do in the field, but also simple, said I have been longing for the city, the university chose to the city, and later want to settle in this.

      Question two: Do your family know you come to our interview, what they think, and then ask, settle here, what do the family think?
      Answer: Support, support, or TMD support! (Make up my own, I will not teach bad children)

      Question three: Do you have a girlfriend?
      Answer: Yes, in this city (stability question, same question)

      Question four: What do you think about pay?
      Answer: I think as a graduate without any work experience, the first thing to think about is the improvement of self-ability, because for a newcomer, access to experience is very important, at this stage I will focus on learning, into the company, rather than the tangle of pay. I believe that the company will have an objective and accurate assessment of my ability, and I will not turn a blind eye to the contribution I make to the company.

      Question five: What do you think about overtime?
      Answer: I look at overtime, since the work, you have to have a sense of responsibility, so, if it is because of work needs and overtime, of course, no problem. But it should also pay attention to improve work efficiency, if it is because of procrastination and overtime, it is not advisable.

      Question six: Do you have any questions?
      The problem is level, you say no is too funny.
      Answer: 1 I as a new born society, I am now very important to the development of self-ability, what is the training of the company's employees?
      2. The company later on in my work on this piece of development focus.

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