iphone - 如何向 UITableView 添加页脚?

标签 iphone uitableview uiview footer

我使用此代码向 TableView 添加页脚。它有 20 个部分,每个部分有几行。有一个 titleForHeaderInSection 和sectionForSectionIndexTitle 方法。

CGRect footerRect = CGRectMake(0, 0, 320, 40);
UILabel *tableFooter = [[UILabel alloc] initWithFrame:footerRect];
tableFooter.textColor = [UIColor blueColor];
tableFooter.backgroundColor = [self.theTable backgroundColor];
tableFooter.opaque = YES;
tableFooter.font = [UIFont boldSystemFontOfSize:15];
tableFooter.text = @"test";
self.theTable.tableFooterView = tableFooter;
[tableFooter release];

我做错了什么?

谢谢

RL

最佳答案

我在我的代码中特别看到

self.theTable.tableFooterView = tableFooter;

作品和

[self.theTable.tableFooterView addSubview:tableFooter];

不起作用。因此,坚持前者并在其他地方寻找可能的错误。 HTH

关于iphone - 如何向 UITableView 添加页脚?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5144835/

相关文章:

iPhone CoreData 应用程序首次启动时崩溃

ios - 自定义TableViewCell触发NSLayoutConstraint错误 'UIView-Encapsulated-Layout-Height'

ios - 使用 renderInContext : for masks created by cgpaths

iPhone,在表格 View 中单击编辑/完成按钮的钩子(Hook)

iphone - ios自动布局约束来调整屏幕尺寸的 View 大小

iPhone 键盘、完成按钮和 resignFirstResponder

objective-c - 核心剧情: How to present popover from a bar selected by the user

ios - 无法将 tintcolor 设置为在 tableview 单元格中设置为背景的图像

ios - 如果我快速选择其中一项,如何删除所有数组

ios - 在 Swift 中为选定的 UIPickerView 行设置动画背景颜色