title: UIActivityIndicatorView not animating
body: <p>I keep getting the UIActivityIndicatorView into view but not animating.</p>
  
  <p>I'm not doing extensive processing I just add my class as a subview to the view of an UITableViewController and do nothing else.</p>
  
  <p>Here is the class I use to layout my UIActivityIndicatorView:</p>
  
  <pre><code>#import "UIXLoaderView.h"
  #import &lt;QuartzCore/QuartzCore.h&gt;
  
  
  @interface UIXLoaderView () {
  @private
      UIActivityIndicatorView *activityIndicatorView;
  }
  @end
  
  @implementation UIXLoaderView
  
  - (id)init {
      self = [super init];
      if (self) {
          // Measure Loading string
          NSString *loadingText = NSLocalizedString(@"Loading...", @"Loading...");
          CGSize textSize = [loadingText sizeWithFont:[UIFont systemFontOfSize:14] forWidth:280 lineBreakMode:UILineBreakModeTailTruncation];
  
          // Create activity gauge
          activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
  
          // now set our frame
          if (activityIndicatorView.frame.size.width &gt; textSize.width) {
              [self setFrame:CGRectMake(0, 0, activityIndicatorView.frame.size.width + 20, activityIndicatorView.frame.size.height + textSize.height + 30)];
          } else {
              [self setFrame:CGRectMake(0, 0, textSize.width + 20, activityIndicatorView.frame.size.height + textSize.height + 30)];
          }
  
          // Add the activity gauge into the view
          [activityIndicatorView setFrame:CGRectMake(((self.frame.size.width - activityIndicatorView.frame.size.width) / 2) , 10, activityIndicatorView.frame.size.width, activityIndicatorView.frame.size.width)];
          [self addSubview:activityIndicatorView];
  
          // Create and add the label
          UILabel *loadingLabel = [[UILabel alloc] initWithFrame:CGRectMake(((self.frame.size.width - textSize.width) / 2), activityIndicatorView.frame.origin.y + activityIndicatorView.frame.size.height + 10, textSize.width, textSize.height)];
          [loadingLabel setText:loadingText];
          [loadingLabel setFont:[UIFont systemFontOfSize:14]];
          [loadingLabel setLineBreakMode:UILineBreakModeTailTruncation];
          [loadingLabel setBackgroundColor:[UIColor clearColor]];
          [loadingLabel setTextColor:[UIColor whiteColor]];
          [self addSubview:loadingLabel];
  
          // rounded corners
          [[self layer] setCornerRadius:9.0];
          //[[self layer] setBorderWidth:1.0];
          //[[self layer] setBorderColor:[[UIColor blackColor] CGColor]];
  
          // back color
          [self setBackgroundColor:[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.5f]];
      }
      return self;
  }
  
  - (id)initWithFrame:(CGRect)frame
  {
      self = [super initWithFrame:frame];
      if (self) {
          // Initialization code
      }
      return self;
  }
  
  /*
  // Only override drawRect: if you perform custom drawing.
  // An empty implementation adversely affects performance during animation.
  - (void)drawRect:(CGRect)rect
  {
      // Drawing code
  }
  */
  
  - (void)removeFromSuperview {
      // Stop animating
      [activityIndicatorView stopAnimating];
  
      // Call super
      [super removeFromSuperview];
  }
  
  - (void)didMoveToSuperview {
      // Move to center
      [self setCenter:[[self superview] center]]; 
  
      // Call super
      [super didMoveToSuperview];
  
      // Animate
      [activityIndicatorView setHidden:NO];
      [activityIndicatorView startAnimating];
  }
  
  @end
  </code></pre>
  
  <p>The header file is:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface UIXLoaderView : UIView
  
  @end
  </code></pre>
  
  <p>Inside a UITableViewController I just call it in the following way:</p>
  
  <pre><code>- (void)viewWillAppear:(BOOL)animated
  {
      [super viewWillAppear:animated];
  
      // If no data start loading animation
      if (!self-&gt;data) {
          // Show the loading view
          loaderView = [[UIXLoaderView alloc] init];
          [self.view addSubview:loaderView];
      }
  
  }
  </code></pre>
  
  <p>The starngest thing here is the animation will start if I tap and move the tableView, but it won't animate once the control is loaded... and I can't fugure out what is happening here. Any clues?</p>