Search code examples
iphoneiosespeak

ESpeak Engine in iOS in synchronous manner


In one of the Table view delegate method I am accessing some strings based on some conditions and i want to speak those strings using ESpeak Engine..In the Log it is giving all the matched strings...but ESpeak Engine is only taking last string (i.e., it is only spelling last string.)

How to make to spell all the strings..

Here is my code..

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)celle forRowAtIndexPath:(NSIndexPath *)indexPath {
        NSLog(@"Final Speak Child List:%@",[stringComponentsForArray objectAtIndex:1]);

       [engine speak:[stringComponentsForArray objectAtIndex:1]];

}

Solution

  • If you are trying to speak all of the strings from the array then you can append all of the strings to an NSString property and then when the UITableView finishes loading you can begin speaking all the strings by speaking that long appended NSString. Otherwise place that in didSelectRowForIndex and call that method there relating to the appropriate indexPath.row for the array.

     [engine speak [stringComponentsForArray objectAtIndex:indexPath.row];