我正在尝试设置一个 UITableView,其中包含 x 个部分和每个部分的 X 行数。
但是我想在 UITableView
的顶部添加一行,有没有办法将其硬编码到 View 中?
我目前根据 NSdictionary 返回部分的数量和每个部分的行数,如下所示。
- (NSInteger)numberOfSectionsInTableView: (UITableView *)tableView
{
// Return the number of sections.
return [letterDictionary count];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// returns the number of rows per section based off each entry in letterDictionary
currentLetter = [sectionLetterArray objectAtIndex:section];
return [[letterDictionary objectForKey:currentLetter] count];
}
最佳答案
您可以向表格 View 添加“标题”。
在你的tableview类中:
self.tableView.tableHeaderView = yourView;
关于iphone - 如何在 UITableView 的开头插入 UITableViewCell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12045786/