0
我想在向UITableView添加單元格時顯示動畫。動畫UITableView更新,成功但需要更多細節
這裏是我實現的(僞代碼)
[self.tableView beginUpdates];
// remove row exists
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:(rows exists) withRowAnimation:UITableViewRowAnimationFade];
(chang data source here, for me, it's NSFetchedResultsController)
// insert new rows
[self.tableView insertRowsAtIndexPaths:(new rows) withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
這段代碼顯示動畫不錯,但它有一個小問題。
單元格顯示從幀矩形(0,0,0,0)到其實際位置的移動動畫,不僅是衰落動畫。
我認爲問題是單元格的初始幀是(0,0,0,0),所以我在cellForRowAtIndexPath中設置了單元格的初始幀屬性,但它不起作用。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
....
cell.frame = CGRectMake(0, indexPath.row * 64, 320, 64);
NSLog(@"set frame");
....
}
如何僅顯示陰影信息,沒有細胞移動動畫?
THX非常感謝!我會盡快嘗試代碼// – moon6pence