Je veux juste sélectionner ma première cellule de ma première section, son quelque chose de simple, mais il ne veux pas travailler ...Impossible de sélectionner la cellule, mais je peux régler la Textlabel
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CellIdentifier";
// Dequeue or create a cell of the appropriate type.
UITableViewCell *cell;
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.textLabel.font = [UIFont boldSystemFontOfSize:17];
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
switch (indexPath.section) {
case 0:
{
NSString *cellIconName = [[self subViewIconNames] objectAtIndex:[indexPath row]];
UIImage *cellIcon = [UIImage imageNamed:cellIconName];
[[cell imageView] setImage:cellIcon];
cell.imageView.alpha = 0.5;
cell.textLabel.textColor = [UIColor grayColor];
cell.textLabel.text = [self.subViewNames objectAtIndex:indexPath.row];
if ([MyAppDelegate sharedAppDelegate].inSubView) {
cell.userInteractionEnabled = NO;
if (indexPath.row == 0) {
firstIndexPath =indexPath;
cell.selected = YES;
cell.textLabel.text = @"yes this changes";
}
}
break;
}
...
Ainsi, les changements de Textlabel à « Oui cela change », mais pas sélectionné ...
J'ai essayé différentes approches, aussi cela après le reload:
NSIndexPath *ip=[NSIndexPath indexPathForRow:0 inSection:0];
[[MyAppDelegate sharedAppDelegate].rootViewController.tableView selectRowAtIndexPath:ip animated:YES scrollPosition:UITableViewScrollPositionBottom];
Je ne sais pas où regarder ... s'il vous plaît aider
Non il n'est toujours pas sélectionné ... très bizarre – meersmans
avez-vous essayé d'utiliser ce setter [cellule définieSélectionnée: OUI animée: OUI]; ? – Romain