Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdating values in NSArray that's backing UITableView
    primarykey
    data
    text
    <p>Cocoa, not iOS. I have an array of items that is backing a UITableview. I go through the array and perform a series of tasks, specifically, I'm calling an external script executable with NSTask. While the task is executing, I want to update the "Status" column in the UITableView. </p> <p>I update the value of the array that's associated to the column, and then call [_TableView reloadData], but No changes in the UI, until all of the processing is done.</p> <pre><code> for (int ix = 0; ix &lt; [_sceneList count]; ix++) { // update status in array backing the TableView [[_sceneList objectAtIndex:ix] setRenderStatus:@"Rendering"]; [_tableView reloadData]; // execute command via shell script [self runScript:@"run_script.bash":appPath:outputFormat:showGUI:threadCnt:resolution:renderFile:outputFile]; [[_sceneList objectAtIndex:ix] setRenderStatus:@"Complete"]; [_tableView reloadData]; } </code></pre> <p>code for run_script:</p> <pre><code>-(void) runScript:(NSString*)scriptName:(NSString*)appPath:(NSString*)outputFormat:(NSString*)showGUI:(NSString*)threadCnt:(NSString*)resolution:(NSString*)renderFile:(NSString*)outputFile; { NSTask *task; task = [[NSTask alloc] init]; NSArray *arguments; NSString* newpath = [NSString stringWithFormat:@"%@/%@",[[NSBundle mainBundle] resourcePath] , scriptName]; [task setLaunchPath: newpath]; arguments = [NSArray arrayWithObjects:appPath, showGUI, renderFile, outputFile, outputFormat, threadCnt, resolution ,nil]; [task setArguments: arguments]; NSPipe *pipe; pipe = [NSPipe pipe]; [task setStandardOutput: pipe]; [task setStandardInput:[NSPipe pipe]]; NSFileHandle *file; file = [pipe fileHandleForReading]; [task launch]; NSData *data; data = [file readDataToEndOfFile]; NSString *string; string = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding]; NSLog (@"script returned:\n%@", string); } </code></pre> <p>Any ideas why the UI isn't updating?</p> <p>Is there some sort of "tableview:updateRow" method I should use?</p> <p>_mike</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload