Я просто хочу, чтобы выбрать свою первую клетку моего первого участка, его что-то простое, но не хочет работать ...Невозможно выбрать ячейку, но я могу установить 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;
}
...
поэтому изменений TextLabel в «да это меняется», но выбран не ...
Я пробовал разные подходы, и это после перезагрузки:
NSIndexPath *ip=[NSIndexPath indexPathForRow:0 inSection:0];
[[MyAppDelegate sharedAppDelegate].rootViewController.tableView selectRowAtIndexPath:ip animated:YES scrollPosition:UITableViewScrollPositionBottom];
Я не знаю, где искать ... пожалуйста, помогите
Нет он все еще не выбран ... очень странно – meersmans
Вы пытались использовать этот сеттер [cell setSelected: YES animated: YES]; ? – Romain