私は客観的な c の開発に慣れていないので、テーブルビューを更新する方法を見つける必要があります。
2UIViewController
つあり、2 つ目ではデータベースにデータを挿入し、最初のビューコントローラーをインスタンス化します。これにはテーブルビューが含まれます。データベースからすべてのデータを回復できるようにするメソッドを呼び出しますが、使用して[tableview reloadData]
も何も起こらcellforrowatindexpath
ず、呼び出されません。
econdviewcontroller: //データベースにデータを挿入し、テーブルビューがあるクラスをインスタンス化し、refresh メソッドを呼び出します
first = [[FirstviewController alloc]initWithNibName:@"FirstviewController" bundle:nil];
[first refreshList];
Firstviewcontrollerで
-(void)refreshList{
self.tableview= [[[UITableView alloc] initWithFrame:self.view.bounds] autorelease];
tableview.dataSource = self;
tableview.delegate = self;
NSMutableArray *array = [[NSMutableArray alloc] init];
//I recover my data from data base
IPADAGRIONEActivityList *arrayActivities = [IPADAGRIONEActivity findAll];
if ([arrayActivities length] > 0)
{
for (IPADAGRIONEActivity * oneRec in arrayActivities)
{
[array addObject:oneRec];
}
}
//activities is NSMutablearray that contains all my data
self.activities = array;
//I build dictionnary
[self buildObjectsDictionnary:activities
NSLog(@"self.act%@",self.tableview);
[array release];
[self.tableview reloadData];
}
//numberofrowsinSection:
NSLog(@"rows%d",[[objects objectForKey:[objectsIndex objectAtIndex:section]] count]);
return [[objects objectForKey:[objectsIndex objectAtIndex:section]] ;
//numberOfSection:
NSLog(@"nbre of section%d",[objectsIndex count]);
return [objectsIndex count];}
//CellforRowatIndexPath: このメソッドにはアクセスしません
if (cell== nil) {
cell = [[MHCActivityListCell alloc]init];
}
IPADAGRIONEActivity *activite;
cell.activityCategory.text = [NSString stringWithFormat:@"%@", [activite EMAIL]];