0
我正在嘗試使用transform屬性爲UILabel設置動畫。它似乎在主動畫中運行良好。但是,一旦我嘗試動畫在主動畫完成塊CGAffineTransform無法在UIView動畫完成塊中工作
UILabel *dateLabel = [[UILabel alloc] initWithFrame:CGRectMake(point.x, point.y, 50, 20)];
dateLabel.text = [NSString stringWithFormat:@"%d", date];
dateLabel.textColor = [UIColor whiteColor];
dateLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:dateLabel];
[UIView animateWithDuration:.4 animations:^{
dateLabel.frame = CGRectMake(self.frame.size.width/2 - 25, 10, 50, 70);
self.calendar.frame = CGRectMake(0, 800, 320, 320);
dateLabel.font = [UIFont fontWithName:@"Bariol-Bold" size:28];
} completion:^(BOOL finished) {
[UIView animateWithDuration:.5 animations:^{
self.monthLabel.transform = CGAffineTransformMakeScale(1.2,1.2);
[self.monthLabel sizeToFit];
} completion:nil];
[UIView animateWithDuration:.5 animations:^{
self.monthLabel.transform = CGAffineTransformMakeScale(1.15,1.15);
[self.monthLabel sizeToFit];
} completion:nil];
calendarAnimation = NO;
}];
您正在該完成塊中同時運行兩個動畫。第二個不應該在第一個的完成塊中嗎? – jrturton
只是試過,仍然沒有工作:( – user2752687
sizeToFit電話應該不會真的在那裏,但我不知道他們會影響動畫。你是什麼意思「不工作」? – jrturton