У меня есть следующий код.Массив построен из XML, поэтому каждый узел имеет заголовок (который будет заголовком раздела) и текст (который будет находиться в самой ячейке)
Таким образом, каждый узел имеет 1 ячейку и 1 заголовок
- (NSInteger)
numberOfSectionsInTableView:(UITableView *)tableView {
return [arrySummaryTitle count];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
AssessObject *newObj1 = [[AssessObject alloc] init];
newObj1=[totalArray objectAtIndex:indexPath.row];
cell.textLabel.text = newObj1.routeImage;
cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.textLabel.numberOfLines = 0;
cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:17.0];
return cell;
}
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
return [arrySummaryTitle objectAtIndex:section];
}
Что я действительно изо всех сил пытаюсь сделать, это перебрать ячейку и заголовок раздела, чтобы перебрать newObj1.routeImage и получить текст ячейки и секцию ячейки из одного массива?Я даже пытаюсь объяснить это, ха-ха
Массив построен как:
Заголовок раздела, Заголовок раздела, Название раздела и т. Д.
То же самое для текста, иони оба в newObj1.wh независимо
Так что мне это нужно, чтобы таблица строилась примерно так:
[Section Header]
[Section Text]
[Section Header]
[Section Text]
и т. д.
Имеет смысл ?!Том