Detect when UITableViewCell goes out of scope

后端 未结 2 2017
终归单人心
终归单人心 2021-01-02 03:02

How can I detect when a UITableViewCell derived object gets removed from a table and into the cache?

2条回答
  •  佛祖请我去吃肉
    2021-01-02 03:41

    Implement either of the following methods. When removed from the table, superview will become nil. When added back to the table, superview will be set to the table view.

    - (void)willMoveToSuperview:(UIView *)newSuperview;
    - (void)didMoveToSuperview;
    

    Also see

    - (void)prepareForReuse;
    

提交回复
热议问题