2011-11-02 38 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

谢谢剪毛。 –