iOS face Test (personal experience) 1

Source: Internet
Author: User

Interview questions 1. Object-Oriented understanding

There are three main features of object-oriented: encapsulation, inheritance, and polymorphism

Encapsulation refers to the class to close all operations, just provide the interface for others to use, the use of people do not need to know how to implement, just need to know how to use the interface on the line

Inheritance refers to a class that inherits a parent class, and the subclass has all the attributes of its parent class, and the subclass can add its own unique functionality.

Polymorphism, which is simply to say that different objects respond differently when confronted with the same method

2. Multithreading

The most common use of multithreading at the time of asynchronous loading, that is, when it takes time to deal with, when the use of multithreading does not block the main thread, the main thread can run smoothly at the same time to asynchronously load some pictures ah, video, etc., and here the picture loading will be put into the thread, about the thread, A process has at least one thread, and the difference between process and thread nature is that the process has a separate memory space and the thread does not. Like the example, can know that the multi-line layer is a bit to improve the execution efficiency of the program, the disadvantage is the need to occupy a certain amount of memory space, here is to open up its own memory space to the thread. And if the number of downloads, the immediate use of multi-threading will cause the thread to block.

3. Circular references

Encountered, the most profound is when using block, the block function inside the use of block, resulting in repeated references. Also, when you start using proxies, the strong method is used to define the proxy, which results in a reference count of + 1 for each proxy referenced to the protocol. Cause a memory leak. I've been using assign since then.

4. Persistence of data

When writing to write directly in normal times, this is where objects such as strings or arrays are saved

In the multi-data time is the use of object archiving method (Nskeyedarchiver), but the biggest flaw in this way is that each time the storage or call will need to be the entire save file or archive, the cost of the system is very large, in the case of small data is not a problem, but if the data more, The best way to use database SQL, the database provides additions and deletions to change the way, directly to the operation of the data, but the disadvantage is that the database writing trouble, and the use of C language, no and OC good combination

Use of 5.cocoapods

Have used, in the development often use is afnetwork, Sdwebimage and Fmdb, these third-party class library use can greatly reduce the amount of code written, at the same time they are also through the precipitation of mature class library, is also very suitable to learn from learning.

The difference between 6.present and push

The role of two is to go to the next page, the only difference is that push will put the next page into the stack, which is the most obvious when the navigation bar, the page is pressed into the stack will only execute once videdidload, then be saved, and present is a direct jump, Re-execute the method on the page, and it will be released automatically after the page is returned.

Optimization of 7.app

The first thing to consider is performance optimization and memory leak avoidance, about performance optimization can give a tableview example, in TableView may appear in the case of loading pictures, if the way to load the image is executed in the main thread, it will obviously block the main thread UI, forming a card phenomenon, This is certainly a thread to deal with, but even if it is multi-threaded, if the number of downloaded threads will still be the card UI, there are some processing, such as when the scrolling slowed down the picture loading, or when the deceleration stopped when the load, which can greatly reduce the number of loads.

With regard to memory leaks, there is a principle in OC about memory handling, who uses, who releases, who opens up memory to use, who is going to release the memory, now that the iOS development has arc mode, this step is simplified, now the system to automatically release the memory, But arc is not omnipotent, sometimes in code processing problems, arc can not solve, for example, an object holds a memory reference count of 2, ARC automatically release it, its reference count-1, this time the object still holds memory, and not completely released, This is usually the time to write errors, so in the system to open up the memory of the time still need to pay attention to some

8.KVC and KVO Application scenarios

KVC is the key value Coding, simply said to access the value of a property, which simplifies our code, KVO (Key value Observer) can also access the property, and listen to the property changes, The most essential difference from KVC is that the properties of the listener through KVO are layered, that is, the parent class that listens to the class's parent class, and so on.

9. Messaging mechanisms

That is, the value of the transfer, in OC, the method of passing the value of more commonly used 5 kinds: notification, singleton, protocol, attribute, block. Different times will have a better effect in different ways. The notification is more abstract, it is applicable to the case of sending messages to multiple objects at the same time, the single case uses only one instance of memory in a class, and the protocol, because OC does not support multiple inheritance, but can satisfy the need by protocol, all classes that follow the protocol can use the method inside; Most of the use of a page jumps to the B page case; block is a new technology that can store the required values in block code blocks, remove them where needed, and pay attention to memory loop reference when using block

10. Heap and Stack differences

Simply put, heap storage of some simple assignment of variables, when not needed by the programmer manually release, stack storage objects, when not in use, the compiler automatically released

11. Screen Fit

Because the iphone has a different screen size, you need to consider how the program will look on your phone during development, that is, the UI. In the UI adaptation, there are two ways, one is the way to drag the control, one is the way the code is written, both ways to achieve the effect of screen adaptation, to see a person's preferences

12. Problems encountered in the project and how to solve them

The more impressive project is an anecdote, in the development process encountered more problems, but the solution is also easy, more difficult is about tableview reuse mechanism, in the reuse mechanism card for a long time, later through a large number of Baidu and asked around the classmates, Understand the principle of the mechanism to solve the problem fundamentally

13. Event mechanism

Trigger events, there are many events in the program, Touch events (gestures), sensor events (device gravity sensor, etc.), remote control events (remote controlled device multimedia playback, etc.)

The main use of the general development process is the gesture touch event, here can be provided by the system of touch, you can also customize the gesture.

14. The directory structure of the sandbox

In iOS, each program has its own sandbox path, all data caches and calls can only be in this path (douments, app, Library, TMP), the sandbox path in each program's path will be notconsistent when re-opened, However, support for iOS systems does not cause data loss

Hello, I was just received your interview notice temporary, thank you for the interview opportunity, but I now in Guangzhou, tomorrow only to Shenzhen, you can do a telephone interview, if you think I am appropriate, I went to your company for an interview, can you 13823390188

iOS face Test (personal experience) 1

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.