i started a tabbed application project, and on my first view i want to get a populated list so i declared a NSArray like follow:
@interface agrospineFirstViewController : UIViewController <UITableViewDelegate ,UITableViewDataSource>
{
NSArray *JournalList;
}
@property (nonatomic,retain) NSArray *JournalList;
@end
and i added the following on the .m :
[super viewDidLoad];
//initialisation de la liste
JournalList = [NSArray arrayWithObjects:@"journal1",@"journal2",nil];
//initialisation du table View
UITableView* tableView=[[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]style:UITableViewStylePlain];
//population de la vue
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [JournalList count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil)
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier];
// Configuration de la cellule
NSString *cellValue = [JournalList objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
return cell;
}
i also droped the tablelist into the view… but still showing an error on numberOfRowsInSection asking to replace “:” by “;”
any help advice to improve ?
Thank you for your time
I think you have not closed viewDidLoad method like this: