2012-02-07 33 views
1

我有一个完全工作UITableView,与删除,排序,插入等动画时,正在绘制的UITableViewCell

如何设置动画像褪色,中间或下到UITableViewCell当细胞被添加到UITableView,而不是当使用UITableViewCellEditingStyleInsert,但是当从一个数组添加项目时

回答

0

您是否试图为每个添加的对象插入一个单元格(使用insertRowsAtIndexPaths:withRowAnimation:)?

可能是这样的:

- (void)addContentFromArray:(NSArray *)array { 
    [self.tableView beginUpdates]; 
    NSMutableArray *indexPaths = [NSMutableArray arrayWithCapacity:[array count]]; 
    for (id object in array) { 
     NSIndexPath *newIndexPath = [NSIndexPath indexPathForRow:[self.dataSource count] inSection:0]; 
     [self.dataSource addObject:object]; 
    } 
    [self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationAutomatic]; 
    [self.tableView endUpdates]; 
} 
+0

进出口目前使用' - (NSInteger的)的tableView:(UITableView的*)的tableView numberOfRowsInSection:(NSInteger的)部分 { 返回[阵列计数]; (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {return cell;}' – feco 2012-02-07 23:03:42