0
我正在设置一个带有部分的UITableView
。 numberOfSectionsInTableView:
方法被调用正确,并返回正确的结果(在我的情况3),但titleForHeaderInSection
根本没有被调用,并且结果tableview包含行但没有部分。titleForHeaderInSection在实现UITableViewDataSource协议时未被调用
有没有办法确保这个方法被tableview调用?
下面是执行:
- (NSString *) titleForHeaderInSection:(NSInteger)section
{
NSString *sectionHeader = nil;
if (section == 0)
{
sectionHeader = @"Alpha";
}
if (section == 1)
{
sectionHeader = @"Beta";
}
if (section == 2)
{
sectionHeader = @"Gamma";
}
NSLog(@"%@", sectionHeader);
return sectionHeader;
}