2016-04-07 37 views
1

我想顯示從一個未知號碼到未知號碼的UILabel中的號碼。假設從40到699.我想逐一展示這個,然後在需要的數字到達時打破循環序列。在目標C中用於循環UIAnimation目標C

E.g {40,41,42 ... 667668669}

我想從標籤刪除以前的號碼,並添加新的號碼標籤對象。 我在for() Loop中混淆UIAnimation。 有沒有人有任何想法如何做到這一點?

+0

想要閃爍的動畫? –

+0

是閃爍的動畫。 –

+0

總之,我想創建我的自定義計時器,但它不是一個計時器,我想顯示在我的服務器上註冊的用戶數量。 –

回答

0

將計時器用於增加計數器的動畫。

int loopCount; 
    NSTimer *myTimer; 

    // Method that calls your timer. 
    - (void)doStuff { 

     loopCount++;. 
     self.yourLabel.alpha = 0; 
     [UIView animateWithDuration:0.65 delay:0 options:UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse animations:^{ 
     self.yourLabel.alpha = 1; 
     } completion:nil]; 

     if (loopCount >= 669) { 
      [myTimer invalidate]; 
      myTimer = nil; 
      self.yourLabel.alpha = 0; 
     } 
    } 

    // Method that kicks it all off 
    - (IBAction)startDoingStuff { 
     myTimer = [NSTimer scheduledTimerWithTimeInterval:0.75 
                target:self 
               selector:@selector(doStuff) 
               userInfo:nil 
                repeats:YES]; 
    } 
+0

它有效。非常感謝先生。 –