私のコードでは、UITableViewのセルを選択したいと思います。ここで選択を行いますが、選択するたびに一瞬だけ選択されてしまい、選択が失われます。
私は何を間違えましたか?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SimpleTableIdentifier"];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"SimpleTableIdentifier"];
}
cell.textLabel.text = [[self tableViewArray] objectAtIndex:indexPath.row];
if(indexPath.row == self.selectedTopicIndex)
{
NSLog(@"DIE DIE DIE DIE DIE!!!");
[cell setSelected:YES];
[cell setSelectionStyle:UITableViewCellSelectionStyleBlue];
[cell setSelected:YES];
}
return cell;
}