uiview의 레이어에 애니메이션을 추가하고 있는데, 첫 번째 애니메이션을 추가 할 때 첫 번째 애니메이션을 추가 할 때 두 번째 애니메이션을 추가하면 첫 번째 애니메이션이 제거되므로 어떻게 두 개의 cabasicanimation을 병렬로 추가 할 수 있습니까? 그렇게하는 법을 도와주세요. 단일 Uiview의 레이어에 두 개의 CABasicAnimations를 추가하는 방법은 무엇입니까?
-(void)viewDidAppear:(BOOL)animated{
if (![ViewController weakDevice]) {
_imageView_BlurBackground.image = _blurBackgroundImage;
}else{
_imageView_BlurBackground.backgroundColor = [UIColor colorWithRed:96.0/255.0 green:96.0/255.0 blue:96.0/255.0 alpha:0.9];
}
CALayer *maskLayer = [CALayer layer];
// Mask image ends with 0.15 opacity on both sides. Set the background color of the layer
// to the same value so the layer can extend the mask image.
maskLayer.backgroundColor = [[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.40f] CGColor];
maskLayer.contents = (id)[[UIImage imageNamed:@"Mask3.png"] CGImage];
// Center the mask image on twice the width of the text layer, so it starts to the left
// of the text layer and moves to its right when we translate it by width.
maskLayer.contentsGravity = kCAGravityCenter;
maskLayer.frame = CGRectMake(0, -_creditListView.frame.size.height, _creditListView.frame.size.width, _creditListView.frame.size.height*2);
// Animate the mask layer's horizontal position
CABasicAnimation *maskAnim = [CABasicAnimation animationWithKeyPath:@"position.y"];
maskAnim.toValue = [NSNumber numberWithFloat:_creditListView.frame.size.height];
maskAnim.fromValue = [NSNumber numberWithFloat:0.0];
maskAnim.repeatCount = HUGE_VAL;
maskAnim.duration = 6.0f;
[maskLayer addAnimation:maskAnim forKey:@"slideAnim"];
_creditListView.layer.mask = maskLayer;
[_scrollView_CreditList setContentSize:CGSizeMake(_scrollView_CreditList.frame.size.width, _imageView_CreditList.frame.size.height+20)];
[self performSelectorOnMainThread:@selector(startRolling) withObject:nil waitUntilDone:YES];}
업데이트 :
첫 번째는, 그 하방 운동의 약 80 %에 도달 동일한 패턴 다음 후속 깜박 하였다 때 흰색 하이라이트 번째 하향 플래시 시작한다.
내 뷰 계층 내가이를 구현하는 방법,
CreditViewController--->
View---->
BlurBackground UIView
FirstAnimationView--->
ScrollView
ImageView
SecondAnimationView--->
ScrollView
ImageView
나에게 당신의 제안을 제공하십시오입니다.
http://stackoverflow.com/questions/17764375/sequence-animation-using-caanimationgroup –
"두 번째 애니메이션을 추가하면 첫 번째 애니메이션이 제거됨"두 애니메이션이 동일한 키 경로를 애니메이션으로 나타 납니까? –
예 그들은 동일한 키 경로를 사용합니다. –