gpt4 book ai didi

iphone - uibuttons的跳跃效果

转载 作者:可可西里 更新时间:2023-11-01 06:17:46 25 4
gpt4 key购买 nike

在我的应用程序中,我使用了移动 subview 。如果它达到 y=150,我想制作一个具有跳跃效果的按钮,我尝试了这个链接 adding bounce effect to appearance of UIImageView它在水平方向上工作,我想要一个垂直方向,这是我的代码,

-(void)godown 
{
if (movingview.center.y < 150) movingview.center = CGPointMake(movingview.center.x, movingview.center.y +5);
if(movingview.center.y ==150)
{
[UIView beginAnimations:@"bounce" context:nil];
[UIView setAnimationRepeatCount:3];
[UIView setAnimationRepeatAutoreverses:YES];
CGAffineTransform transform = CGAffineTransformMakeScale(1.3,1.3);
bt1.transform = transform;
bt2.transform=transform;
[UIView commitAnimations];
}
}

请帮我改成跳跃效果(垂直)?

最佳答案

试试这个。您可以进行一些更改以适合您的需要,

        CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"transform"];
anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
anim.duration = 0.125;
anim.repeatCount = 1;
anim.autoreverses = YES;
anim.removedOnCompletion = YES;
anim.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.2, 1.2, 1.0)];
[senderView.layer addAnimation:anim forKey:nil];

希望这对您有所帮助。

关于iphone - uibuttons的跳跃效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12968301/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com