title: Able to touch the background of activity indicator
body: <p>In my iphone application an activity indicator is shown at the time of webservice call. My problem is that i am able to touch the view on which the activity indicator is shown.My view has textfields and buttons and i am able to enter values in the text fields and also change the button states while the activity indicator is still on it. Have anybody faced a similar situation? Does anybody know a solution to this problem? All helpful suggestions are welcomed.
  Here is my activity indicator class.</p>
  
  <p><strong>ActivityProgressViewController.h</strong></p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface ActivityProgressViewController : UIViewController {
      IBOutlet UIActivityIndicatorView *_activityIndicator;
      IBOutlet UILabel *_labelMessage;
      NSString *_messageToShow;
  }
  
  @property (nonatomic, retain) IBOutlet UIActivityIndicatorView *activityIndicator;
  @property (nonatomic, retain) IBOutlet UILabel *labelMessage;
  
  + (ActivityProgressViewController*) createInstance;
  
  - (void)show;
  - (void)showWithMessage:(NSString*)message;
  - (void)close;
  
  
  + (void)show;
  + (void)close;
  
  @end
  </code></pre>
  
  <p><strong>ActivityProgressViewController.m</strong></p>
  
  <pre><code>#import "ActivityProgressViewController.h"
  
  #define kACTIVITY_INDICATOR_NIB @"ActivityProgressViewController"
  
  @implementation ActivityProgressViewController
  
  @synthesize activityIndicator = _activityIndicator;
  @synthesize labelMessage = _labelMessage;
  
  
  static ActivityProgressViewController *_viewController;
  
  
  - (void)didReceiveMemoryWarning {
      // Releases the view if it doesn't have a superview.
      [super didReceiveMemoryWarning];
  }
  
  - (void)viewDidLoad {
      if (_messageToShow) _labelMessage.text = _messageToShow;
  }
  
  - (void)dealloc {
      [_labelMessage release];
      [_messageToShow release];
      [_activityIndicator release];
      [super dealloc];
  }
  
  + (ActivityProgressViewController*) createInstance {
      _viewController = [[ActivityProgressViewController alloc] initWithNibName:kACTIVITY_INDICATOR_NIB bundle:nil];
      return _viewController;
  }
  
  - (void)show
  {
      [_activityIndicator startAnimating];
  
      UIWindow *window = [[[UIApplication sharedApplication] windows]objectAtIndex:0];
      NSLog(@"[[UIApplication sharedApplication] windows]===%@",[[UIApplication sharedApplication] windows]);
  
      self.view.frame = CGRectMake(window.bounds.origin.x, window.bounds.origin.y, window.bounds.size.width, window.bounds.size.height);
  
      [window addSubview:self.view];
  
  }
  
  
  
  - (void)showWithMessage:(NSString*)message {
      _messageToShow = message;
      [self show];
  }
  
  - (void)close
  {
      [self.view removeFromSuperview];
  
  }
  
  + (void)show {
      if (!_viewController) {
          _viewController = [ActivityProgressViewController createInstance];
      }
      [_viewController show];
  }
  
  + (void)close {
      if (_viewController) {
          [_viewController close];
      }
  }
  
  @end
  </code></pre>
  
  <p>Here is how i <strong>call from my required class</strong>.</p>
  
  <pre><code> [ActivityProgressViewController show];
  
   [ActivityProgressViewController close];
  </code></pre>
  
  <p>I also <strong>call the activity indicator</strong> while exporting audio.
  This is the code I use for exporting                                                         </p>
  
  <pre><code>    -(void)exportAudioFile:(AVComposition*)combinedComposition
  {
  
  [ActivityProgressViewController show];
  
  AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:combinedComposition
                                                                             presetName:AVAssetExportPresetPassthrough];
  
      NSArray *presets =[AVAssetExportSession exportPresetsCompatibleWithAsset:combinedComposition];
  
      NSLog(@"presets======%@",presets);
      NSLog (@"can export: %@", exportSession.supportedFileTypes);
      NSArray *dirs = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *documentsDirectoryPath = [dirs objectAtIndex:0];
      exportPath = [documentsDirectoryPath stringByAppendingPathComponent:@"CombinedNew.m4a"];
      [[NSFileManager defaultManager] removeItemAtPath:exportPath error:nil];
      exportURL = [NSURL fileURLWithPath:exportPath];
      exportSession.outputURL = exportURL;
      exportSession.outputFileType = @"com.apple.m4a-audio";
      exportSession.shouldOptimizeForNetworkUse = YES;
      [exportSession exportAsynchronouslyWithCompletionHandler:^{
          NSLog (@"i is in your block, exportin. status is %d",
                 exportSession.status);
          switch (exportSession.status) 
          {
              case AVAssetExportSessionStatusFailed: 
              {
  
                  break;
              }
              case AVAssetExportSessionStatusCompleted: 
              {
  
                  exportSuccess = YES;
                  if (recorderFilePath) 
                  {
                      NSError *finalurlError;
                      [[NSFileManager defaultManager]removeItemAtPath:recorderFilePath  error:&amp;finalurlError];
                      finalurlError = nil;
                      [[NSFileManager defaultManager]copyItemAtPath:[exportURL path] toPath:recorderFilePath error:&amp;finalurlError];
                      NSLog(@"finalurlError 2-----%@",finalurlError);
                  }
                  [ActivityProgressViewController close];
                  fileUrl = [NSURL fileURLWithPath:recorderFilePath];  
                  [self updatePlayerForUrl:fileUrl];
                  break;
              }
              case AVAssetExportSessionStatusUnknown: 
              {   
  
                  break;
              }
              case AVAssetExportSessionStatusExporting: 
              { 
  
                  break;
              }
              case AVAssetExportSessionStatusCancelled: 
              { 
  
                  break;
              }
              case AVAssetExportSessionStatusWaiting: 
              { 
  
                  break;
              }
              default: 
              { 
                  NSLog (@"didn't get export status");
                  break;
              }
  
          };
      }];
  
      [exportSession release];
  }
  </code></pre>