简体   繁体   中英

How are touches handled by a UITableView?

I'm trying to better understand how UITableView and UITableViewCell work, and one part of that is touch handling.

So when I touch a row on a table view, what exactly happens? My basic understanding is:

  1. UITableView is a UIScrollView , so first it checks if it's a touch or a scroll
  2. If it's not a scroll then the touch gets analyzed to see which row is under the touchpoint
  3. It gets the cell at this indexPath (how?) and tells it to setHighLighted , setSeletected

Is that it? Does anybody have a more thorough understanding of it than that?

Probably somethign along the lines you mentioned, you never know though until you see t he source, why do you want to know anyway? you making your own tableview?

One last step is that the touch gets passed to the cells content view. That way any subviews in the cell will receive touch events. I'm pretty sure this comes after your step 3 and actions from cell selection will be processed first.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM