Pregunta

- (void) didClickDone{
    if (isValide ==0) {
        (...)
        [newFormDataRequest setDelegate:self];
        [newFormDataRequest startAsynchronous];
        (...)
        //show the label
        [self showWithLabel];
    }
}




# pragma mark - AsiHTTPRequest delegate methods
- (void)requestFinished:(ASIHTTPRequest *)request
{
    NSLog(@"PostAdRequest = %@", [request  responseString]);
    HUD.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark.png"]] autorelease];
    HUD.mode = MBProgressHUDModeCustomView;
    HUD.labelText = @"Completed";
    sleep(10);
    [self hudWasHidden];
    [self dismissModalViewControllerAnimated:YES];
}

Estoy tratando de cambiar un MBPrograsshub después de una respuesta positiva de AsihttpRequest. Pero la vista sigue siendo la misma. Sabes por qué ?

Gracias

¿Fue útil?

Solución

Porque el sleep(10) no permite que el Uithread actualice el HUD.

- (void)requestFinished:(ASIHTTPRequest *)request {
    NSLog(@"PostAdRequest = %@", [request  responseString]);
    HUD.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark.png"]] autorelease];
    HUD.mode = MBProgressHUDModeCustomView;
    HUD.labelText = @"Completed";

    [self performSelector:@selector(removeHUD) withObject:nil afterDelay:10.0f];
}

- (void) removeHUD {
   [self hudWasHidden];
    [self dismissModalViewControllerAnimated:YES];
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top