title: play animation regardless of any screen iphone
body: <p>i have some animation to be played at some point in time. that time is decided by some thread running in the backgroud. now i want to play the animation regardless of which screen the user is on. here is screen hierarchy.</p>
  
  <p>login-->homescreen(thread starts running from viewdidload). </p>
  
  <p>from home screen the user may navigate to any other screen and i want the animation to be played. right now i have the animationviewcontrller a membervariable in the homescreen and i am calling it by allocing and initing and pushing and popping when animation is done. and it works only 10% of the time. i have tried performselectoronmainthread and its still the same.</p>
  
  <p>How do i redesign my code such that is plays on anyscreen.</p>
  
  <p>here is my code for my thread.</p>
  
  <pre><code>[self startTimerThread];   // in viewdidload
  
  -(void)startTimerThread
  {
      homescreenthread = [[NSThread alloc] initWithTarget:self selector:@selector(setupTimerThread) object:nil];
      [homescreenthread start];
  }
  -(void)setupTimerThread
  {
      NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
      NSTimer* timer = [NSTimer timerWithTimeInterval:5
                                               target:self
                                             selector:@selector(findnewmessages)
                                             userInfo:nil
                                              repeats:YES];
      NSRunLoop* runLoop = [NSRunLoop currentRunLoop];
      [runLoop addTimer:timer forMode:NSRunLoopCommonModes];
      //[runLoop addTimer:timer forModes:NSRunLoopCommonModes];
      [runLoop run];
      [pool release];
  }
  
  -(void)findnewmessages
  {//finding message from server here. i am using the following request
      NSData *serverReply = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error:&amp;error];
          NSString *replyString = [[NSString alloc] initWithBytes:[serverReply bytes] length:[serverReply length] encoding: NSASCIIStringEncoding];
  </code></pre>
  
  <p>//i have omitted lot of other code.
      }</p>