2011-11-02 42 views
3

我有幾個問題在xcode 4.2開發。在那我創建一個應用程序的客戶端需要一些功能,如文本應該眨眼。如何使用quartzcore框架閃爍的UITextview的文本

  • 在quartzcore框架中如何使文本閃爍。

    如何解決這個問題任何機構都有這個問題的想法試圖幫助解決我的問題,使用任何外部庫。

提前感謝您的幫助。

回答

11

我解決了使用的Core Animation這個問題。

CABasicAnimation *basic=[CABasicAnimation animationWithKeyPath:@"transform"]; 
[basic setToValue:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.25, 1.25, 1.25)]]; 
[basic setAutoreverses:YES]; 
[basic setRepeatCount:MAXFLOAT]; 
[basic setDuration:0.25]; 
[self.imgVArrow.layer addAnimation:basic forKey:@"transform"]; 
9

試試這個:

- (void)blinkAnimation:(NSString *)animationID finished:(BOOL)finished target:(UIView *)target 
{ 
    NSString *selectedSpeed = [[NSUserDefaults standardUserDefaults] stringForKey:@"EffectSpeed"]; 
    float speedFloat = (1.00 - [selectedSpeed floatValue]); 

    [UIView beginAnimations:animationID context:target]; 
    [UIView setAnimationDuration:speedFloat]; 
    [UIView setAnimationDelegate:self]; 
    [UIView setAnimationDidStopSelector:@selector(blinkAnimation:finished:target:)]; 

    if([target alpha] == 1.0f) 
     [target setAlpha:0.0f]; 
    else 
     [target setAlpha:1.0f]; 
    [UIView commitAnimations]; 
} 

叫我的功能上的UILabel:

[self blinkAnimation:@"blinkAnimation" finished:YES target:labelView]; 
+0

謝謝剪毛。 –