2010-10-21 48 views
4

基本上我想檢查一個UITableView中的單元格是否已經加載/查看過,因此我可以在單元格的第一個視圖上執行動畫。有誰知道我會如何去做這件事?如何確定UITableViewCell是否以前已加載?

我猜這可能是一個倒退的做法,如果你能想到一個更好的方式來檢查然後我全部耳朵。

提前致謝!

回答

6

你應該觸發動畫和跟蹤哪些指數路徑已顯示已在tableView:willDisplayCell:forRowAtIndexPath:

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    // NSMutableSet *animatedIndexPaths; <-- this is an ivar. 
    if (![animatedIndexPaths containsObject:indexPath]) 
    { 
     [animatedIndexPaths addObject:indexPath]; 
     // Trigger your cell animation on cell. 
    } 
} 
+0

真棒!得到它在5分鐘內實施和工作。歡呼你的幫助! – AndyDev 2010-10-21 20:32:05

+0

@AndyDev:如果它有效,請'接受'答案,以便它可以幫助其他人提出同樣的問題。謝謝! – 2010-10-22 14:03:33

相關問題