Reputation: 2325
as you see in the screen prints, tableView always displays a single value in the tableView "Title" My problem is to display all the array values detailTableView
- (void)viewDidLoad {
NSArray* tmpArray = [[NSArray alloc] initWithObjects:@"Titre", @"Nom", @"Prenon",@"Adresse",@"Phone",@"Mobile",@"Mail",@"Site",@"Note",nil];
self.detailsTableView = tmpArray;
[tmpArray release];
[super viewDidLoad];
}
- (UITableViewCell *)tableView:(UITableView *)atableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
cell.textLabel.text =[self.detailsTableView objectAtIndex:indexPath.row] ;
return cell;
}
Upvotes: 1
Views: 91
Reputation: 3982
From the screen grab, it looks like you've only got one cell per section. In which case you need to use indexPath.section instead of indexPath.row.
Upvotes: 3
Reputation:
did you set as follows:
- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section {
return [self.detailsTableView count];
}
Upvotes: 0
Reputation: 31730
From the apple Documentation
textLabel
Returns the label used for the main textual content of the table cell. (read-only)
@property(nonatomic, readonly, retain) UILabel *textLabel
Discussion
Holds the main label of the cell. UITableViewCell adds an appropriate label when you create the cell in a given cell style. See “Cell Styles” for descriptions of the main label in currently defined cell styles.
So Create a new UILabel
and add it to textLabel
Upvotes: 1