0
我嘗試這樣做:如何將表格視圖頁腳顏色設置爲與導航相同?
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
CGRect footerFrame = CGRectMake(0.0, self.tableView.bounds.size.height - kCustomRowHeight, self.tableView.bounds.size.width, kCustomRowHeight);
UIView *footerView = [[UIView alloc] initWithFrame:footerFrame];
footerView.backgroundColor = self.navigationController.navigationBar.backgroundColor;
return footerView;
}
但是,使頁腳視圖不可見。
但這個工程:
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
CGRect footerFrame = CGRectMake(0.0, self.tableView.bounds.size.height - kCustomRowHeight, self.tableView.bounds.size.width, kCustomRowHeight);
UIView *footerView = [[UIView alloc] initWithFrame:footerFrame];
footerView.backgroundColor = [UIColor redColor];
return footerView;
}
所以,我怎樣才能使頁腳具有相同的背景顏色和導航欄?