Search code examples
iosiphoneuitableviewuikitdrawrect

iOS : WHO'S in charge of refreshing UI/Screen while UITableView's scrolling?


I was finding ways to calculate FPS as what I said here, holding the idea that when the UITableView scrolls, its drawRect: would be called frame by frame. But it didn't.

The UITableView's drawRect: will be called only once, not matter I drag it up and down quickly or put buttons on it. So does the UITableView's superview and cells. All the UIViews' drawRect:s are called only once for each.

Given that drawRect: called only once, WHO is in charge of refreshing UI/Screen while UITableView's scrolling?

UPDATED 1

I know UITableView's delegate & dataSource are responsible for layout cells to show. But what if tableView just scrolls slightly? Though its delegate & dataSource are not called, the screen's content still changed. On this occasion, who is up to the UI refresh on iPhone screen? scrollView scrolled -> UIKit -> GPU -> LCD Screen?


Solution

  • This is what the UITableView's dataSource and delegate properties are for. They allow you to define who is in charge of setting up the UI and handling user interaction.