2015-06-11 35 views
3

其實我在我的應用程序中使用RESlider。在菜單表格視圖中有一個配置文件圖像,除此之外還有一個通知標籤。現在我想要的是,當用戶按漢堡菜單時,通知標籤(橙色標籤,999號碼)應該從一個小圓點到其原始大小的動畫。如何實現這一點?? enter image description here如何將UILabel從小到原始大小動畫化?

回答

2

在viewDidAppear將這個

-(void)viewDidAppear:(BOOL)animated{ 
    self.label.transform = CGAffineTransformMakeScale(0.01, 0.01); 
    [UIView animateWithDuration:0.5 animations:^{ 
     self.label.transform = CGAffineTransformIdentity; 
    } completion:^(BOOL finished) { 

    }]; 
} 
+0

謝謝利奧這工作:) –

+0

我會'self.label.transform = CGAffineTransformMakeScale(1.0,1.0)'更改爲'self.label.transform = CGAffineTransformIdentity' – NKorotkov

1

變化變換Scale的標籤,就像這樣:

[UIView animateWithDuration:0.5 
          delay:0.0 
         options:UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveEaseInOut 
        animations:^{ 
         timerLabel.transform = CGAffineTransformScale(timerLabel.transform, 0.7, 0.7); 
        } 
        completion:nil]; 
+1

不壞....它的工作原理也 –

+0

不像別人解決方案,這一個循環 – ejanowski

2
myTextLabel.transform = CGAffineTransformMakeScale(0.3, 0.3); 
[UIView animateWithDuration:2.0 
         delay: 0.1 
        options: UIViewAnimationOptionBeginFromCurrentState 
       animations:^{ 
        myTextLabel.transform = CGAffineTransformMakeScale(1.5, 1.5); //grow 
       } 
       completion:^(BOOL finished){ 
        myTextLabel.transform = CGAffineTransformMakeScale(1, 1); 
       }]; 
+0

嗨氖非常感謝您的有用代碼.... –

相關問題