gpt4 book ai didi

ios - iPhone View 移动动画

转载 作者:技术小花猫 更新时间:2023-10-29 10:44:08 24 4
gpt4 key购买 nike

我想在单击按钮时向右移动一个 View 。我写了一些东西,但它不起作用;

UIView* view = [self.view viewWithTag:100];
if (!view) {
NSLog(@"nil");
}

[UIView animateWithDuration:0.3f
animations:^{
[view setTransform:CGAffineTransformMakeTranslation(-100, 0)];

}
completion:^(BOOL finished){

}
];

最佳答案

试试这段代码;

  UIView* view = [self.view viewWithTag:100];
[UIView animateWithDuration:0.5
delay:0.1
options: UIViewAnimationCurveEaseOut
animations:^
{
CGRect frame = view.frame;
frame.origin.y = 0;
frame.origin.x = (-100);
view.frame = frame;
}
completion:^(BOOL finished)
{
NSLog(@"Completed");

}];

关于ios - iPhone View 移动动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14907898/

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