UIActivityIndicatorView not showing on theCamera overlay view when image taking done

425 views Asked by At

I have a UIActivityIndicatorView middle on camera OverlayView.xib. I am taking multiple snap by calling [cameraPicker takePicture] repeatedly. I want to show the indicator when all snaps taking done by the bellow code:

- (void)didTakePicture:(UIImage *)picture {   //Called from picker didFinishPickingMediaWithInfo

   [self.capturedImages addObject:picture];
   snapsCount ++;
   if (snapsCount < noOfSnaps) {
      [cameraPicker takePicture];
   }else {
     overlayView.indicator.hidden = NO;  //Not showing indicator
     [overlayView.indicator startAnimating]; //Not working
   }
}

Can anyone tell me the reason why not showing. I can show the indicator before taking the last snap by the following condition, but why not at last.

if (snapsCount < noOfSnaps) {
    if (snapsCount+1 == noOfSnaps) {

       overlayView.indicator.hidden = NO;  //Show the indicator
       [overlayView.indicator startAnimating];   //Work nicely
       overlayView.userMessage.text = @"Processing";
    }
    [cameraPicker takePicture];
}

Is there anyone faced the problem and know the solution to show the indicator after all snap taking done.

Thanks in advance.

1

There are 1 answers

0
Warif Akhand Rishi On
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{

if (snapsCount > noOfSnaps) {
overlayView.indicator.hidden = NO;  
[overlayView.indicator startAnimating];
}
[NSTimer scheduledTimerWithTimeInterval:0.3
                                 target:self 
                               selector:@selector(didTakePicture:) 
                               userInfo: [info objectForKey:UIImagePickerControllerOriginalImage] 
                                repeats:NO];
}