YasBES
YasBES

Reputation: 2325

problem in display in a tableView

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;

} enter image description here

Upvotes: 1

Views: 91

Answers (3)

Twelve47
Twelve47

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

user141302
user141302

Reputation:

did you set as follows:

- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section    {

return [self.detailsTableView count];
}

Upvotes: 0

Jhaliya - Praveen Sharma
Jhaliya - Praveen Sharma

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

Related Questions