UITableView les multiples sections différentes de la matrice de configuration

Je veux avoir 7 sections avec différentes ligne dans uitableview, je ne sais pas comment dois-je rédiger mon autre tableau et de le définir dans les différentes sections, je l'écris pour un, mais j'ai le même tableau dans chaque section!

vous s'il vous plaît aidez-moi!

Merci d'avance!

Je veux dire un au-dessous de l'image, mais avec le tableau différent : par exemple je ne veux pas avoir de test et de bon dans chaque sections

voici mon code:

@synthesize monthTitle;
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super init];
if (self) {
monthTitle = [[NSMutableArray alloc] init];
}
return self;
}
- (void)didReceiveMemoryWarning
{
//Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
//Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
arry = [[NSMutableArray alloc] init];
[arry addObject:@"test"];
[arry addObject:@"hey"];
//Uncomment the following line to preserve selection between presentations.
//self.clearsSelectionOnViewWillAppear = NO;
//Uncomment the following line to display an Edit button in the navigation bar for this view controller.
self.navigationItem.leftBarButtonItem = self.editButtonItem;
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd 
target:self action:@selector(addNewItem)];
self.navigationItem.rightBarButtonItem = rightButton;
}
-(void)addNewItem{
[arry addObject:@"New Day"];
[self.tableView reloadData];
}
//- (IBAction)DeleteButtonAction:(id)sender
//
//{
//   
//   [arry removeLastObject];
//   
//   [self.tableView reloadData];
//   
//}
- (void)viewDidUnload
{
[super viewDidUnload];
//Release any retained subviews of the main view.
//e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
//Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
//Return the number of sections.
return 7;
//_week.days.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
//Return the number of rows in the section.
return [arry count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [self.tableView 
dequeueReusableCellWithIdentifier:@"Cell"];
cell.textLabel.text = [arry objectAtIndex:indexPath.row];
return cell;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
if(section == 0)
return @"Monday";
else if(section == 1){
return @"Tuesday";
}else if(section == 2){
return @"Wednesday";
} else if(section == 3){
return @"Thuesday";
} else if(section == 4){
return @"Friday";
} else if(section == 5){
return @"Saturday";
}else
return @"Sunday";
}
//Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
//Return NO if you do not want the specified item to be editable.
return YES;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle 
forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)  
{
[arry removeObjectAtIndex:indexPath.row];
//[self.monthTitle removeObjectAtIndex:indexPath.row];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:
UITableViewRowAnimationFade];
//   }else if (editingStyle==UITableViewCellEditingStyleInsert) {
} 

//[self.tableView reloadData];
}

#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//Navigation logic may go here. Create and push another view controller.
/*
<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib
name#>" bundle:nil];
//...
//Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
*/
}
@end

OriginalL'auteur | 2012-07-27