2016-04-21 74 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 –

回答