Я просто хочу выбрать свою первую ячейку моего первого раздела, это что-то простое, но оно не хочет работать ...
- (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;
}
...
Таким образом, текстовая метка меняется на "да, это меняется", но выбирается нет ...
Я пробовал разные подходы, также это после перезагрузки:
NSIndexPath *ip=[NSIndexPath indexPathForRow:0 inSection:0];
[[MyAppDelegate sharedAppDelegate].rootViewController.tableView selectRowAtIndexPath:ip animated:YES scrollPosition:UITableViewScrollPositionBottom];
Я не знаю, где искать ... пожалуйста, помогите