如何檢測UITableViewCell派生對象何時從表中移除並進入緩存?當UITableViewCell超出範圍時檢測到
11
A
回答
14
執行以下任一方法。當從表格中移除時,超級視圖將變爲零。當添加回表格時,superview將被設置爲表格視圖。
- (void)willMoveToSuperview:(UIView *)newSuperview;
- (void)didMoveToSuperview;
另見
- (void)prepareForReuse;
4
IOS 6.0之後你的UITableViewDelegate以下方法
- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
Use this method to detect when a cell is removed from a table view, as opposed to monitoring the view itself to see when it appears or disappears.
+1
我認爲你的意思是> = iOS6。 – 2015-08-09 22:41:08
相關問題
- 1. C++ - 檢測超出範圍的訪問
- 2. PreparedStatement拋出索引超出範圍時,它不超出範圍
- 3. 當對象超出範圍/得到無效時收到通知
- 4. 當一個變量超出範圍時,它永遠不能回到範圍
- 5. SDL_image超出範圍
- 6. RowIndex超出範圍
- 7. NSURL超出範圍
- 8. nsstring - 超出範圍
- 9. NSNumber超出範圍?
- 10. Javascript:超出範圍?
- 11. IndexError ...超出範圍,
- 12. NSDate超出範圍
- 13. Java超出範圍
- 14. googletesting超出範圍
- 15. 蟒:超出範圍
- 16. android:pointerIndex超出範圍
- 17. 多維數組超出範圍檢查
- 18. 索引1超出範圍時出錯
- 19. 執行Pex單元測試時出現「超出路徑範圍」
- 20. 如何檢測哪個iBeacon超出範圍?
- 21. 檢測哪個BT設備超出範圍
- 22. 夫特檢測是否信標超出範圍
- 23. 如何檢測ScrollViewer是否超出其可用範圍
- 24. Java泛型,檢測超出範圍字節
- 25. 當某個時間範圍超過
- 26. uitableviewcell裏面的uicollectionview滾動會因索引超出範圍
- 27. 當我的代碼出現在範圍內時,爲什麼我得到IndexError:列表索引超出範圍?
- 28. .NET即時超出範圍通知?
- 29. 修剪時間超出範圍
- 30. D3js X軸時間超出範圍
它不會在iOS 6.x中工作我已經實現了所有3種方法,willMoveToSuperview和didMoveToSuperview只會在我第一次滾動tableview時被調用。每當我滾動表格視圖時,prepareForReuse就會被調用。所以不可能通過前兩種方法確定單元格是否已從表格視圖中移除。 3.方法在重用時調用,而不是從tableview中刪除。 – Mert 2013-09-17 08:45:55