Search code examples
xcodetableviewvoiceover

Xcode bug? VoiceOver with TableView


I was just wondering is this an existing bug OR is there anyway to fix this. When in tableview, turning on voiceover will result in empty table cells... anyone?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"tableCell";

//Exisint bug if using TableViewCell
TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[TableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell.
cell.pLabel.text = [self.tableArrayPlaces objectAtIndex:[indexPath row]];

return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSString *selectedDest = [tableArrayPlaces objectAtIndex:indexPath.row];

//Get the selected country
NSLog(@"SelectedDest %@", selectedDest);
}

Edited: Codes are added. This is my codes for populating my cells. In storyboard I set it to "push", can't seem to work. Any help?


Solution

  • - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
    static NSString *CellIdentifier = @"tableCell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    // Configure the cell.    
    cell.text = [tableArrayPlaces objectAtIndex:[indexPath row]];
    
    return cell;
    }
    

    Instead of using my own cellView, I used UITableViewCell. This solves my problem. But of course I can no longer do any linking at my storyboard directly.