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;
}