我想用Blink动画更改我的UILabel文本。文本应该是黑色的“text1”,消失,然后改为“text2”和红色,反之亦然。 这是我的代码UIView动画自动反向和重复不起作用
#import "ViewController.h"
#import <QuartzCore/QuartzCore.h>
@interface ViewController()
@property (weak, nonatomic) IBOutlet UIImageView *image;
@property (weak, nonatomic) IBOutlet UILabel *label;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self performSelector:@selector(combineAnimations) withObject:self afterDelay:0.0];
self.label.textColor = [UIColor blackColor];
self.label.text = @"text1";
[self animateView];
}
- (void) animateView {
[UIView animateWithDuration:2.0
delay:0.0
options:UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat |UIViewAnimationOptionCurveEaseInOut
animations:^{
self.label.text = @"text2";
self.label.textColor = [UIColor redColor];
}
completion:nil];
}
我在想什么?
你目前的代码? –
第二个文本与前一个文本重叠一段时间,然后再次变回相同的效果。 –