2012-10-24 62 views
0
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{ 
    return [[self.frc sections] count]; 
} 


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 
    id <NSFetchedResultsSectionInfo> sectionInfo = [[self.frc sections] objectAtIndex:section]; 
    return [sectionInfo numberOfObjects]; 
} 

- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section 
{ 
    id <NSFetchedResultsSectionInfo> sectionInfo = [[self.frc sections] objectAtIndex:section]; 

    return [sectionInfo name]; 
} 

我應該有一個部分,標題在它之前......代之以這個代碼把標題放在它之後......就像第一部分沒有標題,但第二個部分沒有標題有第一個但沒有內容的標題(不應該有第二個部分)fetchRequestController無法正確標記段標題

什麼給?

回答

0

您正在使用:

- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section 

它是爲頁腳,嘗試使用這個來代替:

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section