Iosui View interview and principle summary

Source: Internet
Author: User

Summary:

1,UITableViewCell The reuse mechanism to describe?

2, UITableView related data source synchronization problem, that is, how to solve the multithreading situation in TableView, data processing?

3, whether have encountered the problem of lag and dropped frames, how to solve, why the problem of lag and dropped frames?

4. Draw Drawing & Asynchronous drawing, what is off-screen rendering

5, the image display principle describes

6. Event delivery process and view response process in iOS

is asking:

First, the reuse mechanism ofUITableViewCell

During the development process,

-(Nullable __kindof UITableViewCell *) Dequeuereusablecellwithidentifier: (NSString *) identifier; -(__kindof UITableViewCell *) Dequeuereusablecellwithidentifier: (NSString *) identifier Forindexpath: (NSIndexPath *) Indexpath Ns_available_ios (6_0);
There are two ways to tune upUITableViewCellParty reuse mechanism, when TableView new, will create a new reuse pool viewreusepool, this reuse pool in OC bottom may be a queue, save the current Cell.pool in the reuse identifier isReuseidentifier, which identifies different kinds of cells, so when we callDequeuereusablecellwithidentifier, you will pass the currentReuseidentifier finds the corresponding cell, which is the prototype of the display.
When you create a tableview, you create an empty
Viewreusepool, and then manages the pool inside the tableview, usually in two ways, one is to take out an empty cell and then to create a new cell, and the other isThe cell is pre-registered and then removed directly from the reuse pool , without the need for initialization .
For the first use: the first call to Tableview:cellforrowatindexpath because the reuse pool is empty, the cell is first created to be added to the reuse pool, a second call, and a cell in the current reuse pool, because Talbeview is not filled , and the only cell of the reuse pool is already in use, so the cell is still nil, and then continue to create a new cell and return, reuse the pool and add a cell, The number of cells in the current multiplexing pool is 2. If the current tableview can only hold 5 cells. When you scroll to the 6th cell, the cell from the TableView pool will be the cell on line No. 0. And so on, when you scroll to the 7th row, The cell in line 1th will be removed from the reuse pool. In addition, you will no longer continue to add new cells to the pool at this time.
Two, the UITableView data source synchronization problem
How to solve the problem of data synchronization in multi-threaded situations in TableView?
There are two scenarios: 1, parallel access, data copy

Iosui View interview and principle summary

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.