I'm writing an app for my father's business, it involves lists, however, I have seen that it seems to reorganize the list, even though I don't want it to. For example, all of section 1 is supposed to say one thing, when I scroll down, content from the other sections is put in section 1's cells, this goes for the other sections as well. Here's all the table code, if it helps.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == ENGINEER_ID) {
return 3;
} else if (section == FIREMAN_ID) {
return 3;
} else if (section == CONDUCTOR_ID) {
return 3;
} else if (section == TRAINMASTER_ID) {
return 3;
} else {
return 0;
}
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
if ([indexPath section] == ENGINEER_ID) {
cell.textLabel.text = @"Engineer";
} else if ([indexPath section] == FIREMAN_ID) {
cell.textLabel.text = @"Fireman";
} else if ([indexPath section] == CONDUCTOR_ID) {
cell.textLabel.text = @"Conductor";
} else if ([indexPath section] == TRAINMASTER_ID) {
cell.textLabel.text = @"Trainmaster";
}
}
// Configure the cell.
return cell;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
if (section == ENGINEER_ID) {
return @"Master Engineer II";
} else if (section == FIREMAN_ID) {
return @"Fireman";
} else if (section == CONDUCTOR_ID) {
return @"Conductor";
} else if (section == TRAINMASTER_ID) {
return @"Trainmaster";
} else {
return @"What.";
}
}