iOS face question (i)

Source: Internet
Author: User

1. What are the differences between MVC and MVP and what are the pros and cons of using it?
    • The relationship between V and C in MVC: C can control the rendering of V, which is shown in V, and V on the other hand? User events can also be used for C to do some processing.

    • The relationship between C and M: C can modify M. The relationship between M and V: M can change V, v reads M to give it the data, can display the interface. In MVC, there is a dependency between V and M. In the case of MVC, the network is originated from C, and the business logic assumed by C as a whole will be larger, it plays a part in controlling V and M.

    • MVP is protocol-oriented programming, and V is completely irrelevant to model, and there is no reference or dependency between them. The coupling operation is all handled by presenter.

    • Network requests are initiated in model, the data is passed to p to be processed, V is also a kind of, it is to take the data, it will obey the protocol provided by P, implement the Protocol method provided by P. Once you get the data, you can go in and show it. Of course it does. Some of the initiating operations are performed by C. The C-Polygon code in MVP is very small, and the main logic is handled by P. Because it is programming to the protocol, so at the time of development, it is completely possible to wrap up the envelope, V and C completely do not need to care about the layer.

      2. What are the common design patterns in the MVC classic architecture?
      The design patterns included in the diagram are:
    • Delegate (proxy mode)
    • Notification & KVO (Viewer mode)
    • Target-action (Command mode)
    • MVC (mediator mode, built-in policy mode)

3, how to solve the success of iOS packaging, running on the iphone will flash back, black screen problem?
    • Certificate errors, such as a package that uses a publishing certificate to hit the App Store
    • The device is not in the developer account.
    • There are some flashbacks, like IOS10, we add that access, such as camera access, is the plist?

      4, talk about the principle of the realization of the dictionary in OC?
    • ? The bottom of some language dictionaries is a hash table.
    • Hash table (essentially an array)
    • hash function: MD5, hash algorithm, SHA1

5. What is the difference between the message sending mechanism and the message forwarding mechanism in iOS?
    • Message sending mechanism: a process that uses the runtime to find the imp quickly by selector
    • When the method is executed, the compiler compiles the method into the Objc_msgsend () function
    • Message forwarding mechanism: IMP cannot find the time, through some methods to do the forwarding processing

      6, the communication between components, is through what way to do, please explain in detail.
    • In the way of routing, through the way of routing to achieve the switch between the modules, the main project with the module, not directly referenced. Neither the module nor the module is directly cited. When it comes to direct, the dependency will be stronger. In the middle of the router, the coupling can be reduced.
    • Router is implemented using Target_action and nsinvocation, which are actually command patterns.

      7, Sdwebimage How to clean up the cache? There are two ways to clean up the cache:
    • 1. Clean up according to the time period:
      Steps:
      1. Find the disk cache directory
      1. Make?? Retrieve the cache file according to the incoming key
      1. Get more than 7 days of files
      1. Put more than 7 days of documents into the?
    • 5. Save the file without expiration and calculate the total size of the document.

    • 2. Clean up according to the defined disk size
      Steps:
    • 1. If the disk is set to the most storage. Most of the cache is greater than 0, and the current cache? Small already? The largest cache? small
    • 2. Clear the cache until the cache reaches half the maximum cache.
    • 3. When the removal, although the picture is not expired, it will be based on the most of the time to delete first,

8. How does the sdwebimage handle the received memory warning?
    • Autopurgecache this class to handle memory warnings
    • Is this class inherited? Nscache.
    • A memory warning is found, and the removeallobjects is cleaned out.
9, Sdwebimage How to calculate the cost of the picture?
    • Calculate the memory occupied by the picture? Small. High case factor width *?

    • Calculate in cache? small. In the synchronized queue, get the path to the picture, and then stack it in turn.

10. What is the difference between clear and clean in sdwebimage?

Clean deletes the cache, only a portion is deleted, depending on the expiration time and space size
Clear Entire Directory Delete all

The answer is to collect, if there is anything wrong, please correct me!

iOS face question (i)

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.