Ios UIButton将不执行CATTransformM3DMakeScale
我试图在Ios UIButton将不执行CATTransformM3DMakeScale,ios,uibutton,Ios,Uibutton,我试图在UIButton的层上执行CATTransferM3DMakeScale,但缩放变换似乎不起作用。位置动画有效,但比例无效 [UIView animateWithDuration:animationOutDuration delay:0.0f options:UIViewAnimationOptionCurveEaseIn animations:^{ self.alpha
UIButton的
层上执行CATTransferM3DMakeScale
,但缩放变换似乎不起作用。位置动画有效,但比例无效
[UIView animateWithDuration:animationOutDuration delay:0.0f
options:UIViewAnimationOptionCurveEaseIn
animations:^{
self.alpha = 0.0f;
CGPoint position = self.layer.position;
position.y += self.bounds.size.height*animationTranslationPercentage;
self.layer.position = position;
self.layer.transform = CATransform3DMakeScale(animateOutEndScale, animateOutEndScale, 1.0f);
} completion:^(BOOL finished) {
我编写了一些类似于您的代码,并替换了一些参数。它很好用
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(120.0f, 20.0f, 100.0f, 50.0f)];
[button setBackgroundColor:[UIColor redColor]];
[button setTitle:@"lololo" forState:UIControlStateNormal];
[self.view addSubview:button];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[UIView animateWithDuration:1.0
delay:0.0f
options:UIViewAnimationOptionCurveEaseIn
animations:^{
button.alpha = 0.0f;
CGPoint position = button.layer.position;
position.y += button.bounds.size.height*2.0;
button.layer.position = position;
button.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.0f);
} completion:^(BOOL finished) {
}];
});
按钮向下移动、缩放和淡入
所以我猜你的
animateoutndscale
可能是1.0f你的animateoutndscale的值是多少?所以比例是0.2f,但我意识到超级类的CATTransferm3dMakeScale也是.95f。愚蠢的错误,它的工作!