У меня в рабочем приложении для iphone есть рабочий стол, и я использую второе представление с помощью navigationController.
Но когда я пытаюсь выбрать ячейку на начальном экране, она не отвечает, т.е. не выделяется синим цветом, нет выделения.
Кто-нибудь может подсказать, что я мог упустить или что на самом деле отвечает за выбор ячейки, когда пользователь нажимает на нее?
ОК, спасибо за ваши предложения - все равно не повезло. вот мой код:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]autorelease];
[cell setSelectionStyle: UITableViewCellSelectionStyleBlue];
UIView *selectionView = [[[UIView alloc] init] autorelease];
selectionView.backgroundColor =[UIColor redColor];
cell.selectedBackgroundView = selectionView;
}
// format text
cell.textLabel.font = [UIFont fontWithName:@"Arial" size:12];
cell.textLabel.text = [tableArray objectAtIndex:indexPath.row];
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//NSUInteger row = indexPath.row;
//[DetailView selectRowAtIndexPath:indexPath animated:YES];
//UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath.row];
//[cell setSelectionStyle: UITableViewCellSelectionStyleBlue];
DetailView *detailView = [[DetailView alloc] initWithNibName:@"DetailView" bundle:nil];
[self.navigationController pushViewController:detailView animated:YES];
[DetailView release];
}