MWPhotoBrowser icon indicating copy to clipboard operation
MWPhotoBrowser copied to clipboard

Image loading indicator does not work

Open rafalkitta opened this issue 11 years ago • 8 comments

Hi, I observed that image loading indicator des not work. It always appears and disappears properly but never animate.

simulator screen shot 16 oct 2015 15 23 48

I found that MWZoomingScrollView does not contain any image in photo property during fetching image from web. So it can not satisfy condition above:

- (void)setProgressFromNotification:(NSNotification *)notification {
    dispatch_async(dispatch_get_main_queue(), ^{
        NSDictionary *dict = [notification object];
        id <MWPhoto> photoWithProgress = [dict objectForKey:@"photo"];
        if (photoWithProgress == self.photo) {
            float progress = [[dict valueForKey:@"progress"] floatValue];
            _loadingIndicator.progress = MAX(MIN(1, progress), 0);
        }
    });
}

rafalkitta avatar Oct 16 '15 13:10 rafalkitta

I'm experiencing the same issue.

reinholdB avatar Nov 04 '15 14:11 reinholdB

I'm experiencing the same issue.

mjasa avatar Dec 07 '15 11:12 mjasa

I'm experiencing the same issue. How fix it?

DevChen avatar Jan 04 '16 06:01 DevChen

I'm experiencing the same issue. How fix it?

RB-King avatar Apr 09 '16 12:04 RB-King

Me too, please help us 👍

listicos avatar Apr 11 '16 04:04 listicos

@listicos @JaydeepPatel @DevChen @rafalkitta Check your code for something that cancels your web operations on view disappearance. And by view I mean a controller that presents your MWPhotoBrowser. Because that 'bug' happens only when an image downloading operation is rapidly canceled right after beginning.

Mehdzor avatar Apr 28 '16 23:04 Mehdzor

I have the same issue and there isn't anything that cancels downloading operation!

mizdler avatar May 10 '16 13:05 mizdler

Put this methods in your view controller, it will solve your issue.

#pragma mark - MWPhotoBrowserDelegate

-(NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser { return _photos.count; }

-(id )photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)indexed { if (indexed < _photos.count) return [_photos objectAtIndex:indexed]; return nil; }

-(id )photoBrowser:(MWPhotoBrowser *)photoBrowser thumbPhotoAtIndex:(NSUInteger)indexed { if (indexed < _thumbs.count) return [_thumbs objectAtIndex:indexed]; return nil; }

//-(MWCaptionView *)photoBrowser:(MWPhotoBrowser *)photoBrowser captionViewForPhotoAtIndex:(NSUInteger)index { // MWPhoto *photo = [self.photos objectAtIndex:index]; // MWCaptionView *captionView = [[MWCaptionView alloc] initWithPhoto:photo]; // return [captionView autorelease]; //}

//-(void)photoBrowser:(MWPhotoBrowser *)photoBrowser actionButtonPressedForPhotoAtIndex:(NSUInteger)index { // NSLog(@"ACTION!"); //}

-(void)photoBrowser:(MWPhotoBrowser *)photoBrowser didDisplayPhotoAtIndex:(NSUInteger)indexed { NSLog(@"Did start viewing photo at index %lu", (unsigned long)indexed); }

//-(NSString *)photoBrowser:(MWPhotoBrowser *)photoBrowser titleForPhotoAtIndex:(NSUInteger)index { // return [NSString stringWithFormat:@"Photo %lu", (unsigned long)index+1]; //}

-(void)photoBrowserDidFinishModalPresentation:(MWPhotoBrowser *)photoBrowser { // If we subscribe to this method we must dismiss the view controller ourselves NSLog(@"Did finish modal presentation"); [self dismissViewControllerAnimated:YES completion:nil]; }

jayjayesh avatar Sep 01 '16 12:09 jayjayesh