DidSelectRowAtIndexPath not showing view

I have a tableView, and when the user selects one of the cells, im loads a large image.

This download takes 10 seconds and I would like to show a small image with an arrow.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    loadingView = [[LoadingHUDView alloc] initWithTitle: NSLocalizedString(@"Loading image",@"")];
    [self.view addSubview:loadingView];
    [loadingView startAnimating];
    loadingView.center = CGPointMake(self.view.bounds.size.width/2, 150);
    [imageView loadImage: path];
    [loadingView removeFromSuperview];
}

The problem is that the view (loadView) is never displayed. It seems that calling loadImage prevents it from being displayed. Can I make this view appear?

+3
source share
1 answer

the problem is that loading the image binds the stream, so the view is not updated with the rotation symbol.

, , !

, .

, :

[self performSelectorInBackground:(@selector(loadBigImage)) withObject:nil];

, -loadBigImage NSAutorelease:

-(void)loadBigImage {
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    //Code to load big image up
    [pool drain];
}

, .

,

+2

Source: https://habr.com/ru/post/1716583/


All Articles