title: MBProgressHUD has a chunk taken out of the middle?
body: <p>I'm examining some code written by someone else, as part of a new job I've been hired for.  One of the bugs confronting me is that, on certain pages, when the <a href="https://github.com/jdg/MBProgressHUD" rel="nofollow noreferrer">MBProgressHUD</a> is displayed for "Logging In" or "Connecting," it gets a chunk taken out of the middle.  For example:</p>
  
  <p><img src="https://i.stack.imgur.com/igV38.png" alt="enter image description here"></p>
  
  <p>Obviously what I'm looking for is something a little more like this:</p>
  
  <p><img src="https://i.stack.imgur.com/9NjxM.png" alt="enter image description here"></p>
  
  <p>It only seems to happen when the app returns from the background (i.e. not when the app is first booting up, when we also use <code>MBProgressHUD</code> but it works perfectly), and only on certain pages.  The box loads correctly, and then about half a turn of the Activity Indicator later, that hole appears.  It then stays like that until the box disappears.</p>
  
  <p>I'd add some code to look at, but to be perfectly honest, I don't know where to start.  I can't think of anything that could take a chunk out of the middle like that, and as you can see from the transparency of the second picture, there doesn't seem to be a box of that shape/size behind the Activity Indicator that could be accidentally turning green.</p>
  
  <p>I've never used <code>MBProgressHUD</code> myself before, and I've never encountered a graphical bug of this nature.  Does anyone know what is going on, or failing that, can anyone give me some leads to investigate regarding what <em>could</em> be causing this behavior?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Below is the code used to add the Activity Indicator to the HUD (from within the <code>MBProgressHUD</code> object):</p>
  
  <pre><code>// Update to indeterminate indicator
  [self.indicator removeFromSuperview];
  self.indicator = nil;
  if (IOSVersion &gt;= 8.0 &amp;&amp; (DeviceScreenSize().height &gt;= 1136.0 || DeviceScreenSize().width &gt;= 1136.0)) {
      self.indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
  } else {
      self.indicator = MB_AUTORELEASE([[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]);
  }
  [(UIActivityIndicatorView *)indicator startAnimating];
  [self addSubview:indicator];
  </code></pre>
  
  <p>This is part of a larger <code>updateIndicators</code> method, but the salient points are there: the indicator is removed (in case there was another there before), then it is re-added and animated.  Comment out either of the <code>startAnimating</code> or <code>addSubview</code> lines, and the HUD appears without the Activity Indicator, but the problem never occurs.</p>
  
  <p>That sounds to me like the animation of the Activity Indicator is somehow causing the missing piece of the underlying view.  But why would that be?  Has anyone heard of that kind of thing before?</p>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>As far as I can tell, the problem only happens on one ViewController in the whole app, and yet that ViewController never references <code>MBProgressHUD</code> or Activity Indicators of any kind.  And all of that functionality is in the AppDelegate method <code>applicationDidBecomeActive:</code>, as below:</p>
  
  <pre><code>MBProgressHUD* hud = [[MBProgressHUD alloc] initWithWindow:self.window];
  [self.window addSubview:hud];
  hud.labelText = LocalizedString(@"Logging in...");
  [hud showAnimated:YES whileExecutingBlock:^{
          User* U = self.SelectedUser;
          if (!isEmpty(U)) {
              if ([U networkLogin]) {
                  [self setSelectedUser:U];
                  if ([U Disabled] != disabledTypesNone) {
                      [Flurry logEvent:@"Login Failed" withParameters:@{@"Name": U.DisplayName,
                                                                        @"DeviceID": [@([Device sharedDevice].DeviceID) stringValue],
                                                                        @"Disabled": [@([U Disabled]) stringValue]}];
  
                      ret = NO;
                  } else {
                      [Flurry logEvent:@"Login" withParameters:@{@"Name": U.DisplayName,
                                                                 @"DeviceID": [@([Device sharedDevice].DeviceID) stringValue]}];
                      [Flurry setUserID:[NSString stringWithFormat:@"%@ - %@", U.EmpID, U.DisplayName]];
                  }
              } else {
                  ret = NO;
              }
          }
  } completionBlock:^{
      [hud removeFromSuperview];
      if (!ret) {
          [[NSNotificationCenter defaultCenter] postNotificationName:kDisplayLogin object:nil];
      } else {
          [[NSNotificationCenter defaultCenter] postNotificationName:kLoggedIn object:nil];
      }
  }];
  </code></pre>
  
  <p>Since it's happening in AppDelegate, it ought to be the same throughout the app, correct?  And yet, when that same code is called (from AppDelegate, as before) while the app is on a different ViewController, it works with no problems.</p>
  
  <p>What might make the behavior of that method different between different ViewControllers?</p>