2016-04-21 66 views
0
[self.tableView beginUpdates]; 
[self.tableView insertRowsAtIndexPaths:indexPathsToBeInserted withRowAnimation:UITableViewRowAnimationFade]; 
[self.tableView endUpdates]; 


- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { 
    if (section == someSection) { 
     UIView *footerView = [[UIView alloc] init]; 
     footerView.backgroundColor = [UIColor someColor]; 
     return footerView; 
    } 
    else { 
     return nil; 
    } 
} 

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { 
    if (section == someSection) { 
     return 10; 
    } 
    else { 
     return 0; 
    } 
} 

没什么特别的。
只需提供一个页脚视图并以某种方式触发插入行方法,页脚视图就会像每次放下时一样动画,您可以通过在模拟器中转换慢速动画来更轻松地观看此视图。viewForFooterInSection动画意外,当我呼叫insertRowsAtIndexPaths

我不知道如何让动画不见了,它确实是不需要的。

+0

看看这个帖子http://stackoverflow.com/questions/5740518/uitableview-footer-stop-from-floating-over-content –

回答