Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 第二个动画的中心不使用新位置_Ios_Animation_Transform_Frame - Fatal编程技术网

Ios 第二个动画的中心不使用新位置

Ios 第二个动画的中心不使用新位置,ios,animation,transform,frame,Ios,Animation,Transform,Frame,我在iOS中运行两个动画时遇到问题。首先,我尝试通过更改第一个动画集中的帧,将图像从屏幕底部移动到顶部,然后在完成时,我尝试通过变换比例来扩展对象的长度。但由于某种原因,一旦第一个动画完成,对象就会回到屏幕底部的原始位置,并且在屏幕外发生不断增长的变换。有人能帮我吗?提前感谢您的帮助,以下是我的代码: CGRect fullview = CGRectMake(59, 102, 650, 150); CGRect iconView = CGRectMake(59, 102, 290, 150);

我在iOS中运行两个动画时遇到问题。首先,我尝试通过更改第一个动画集中的帧,将图像从屏幕底部移动到顶部,然后在完成时,我尝试通过变换比例来扩展对象的长度。但由于某种原因,一旦第一个动画完成,对象就会回到屏幕底部的原始位置,并且在屏幕外发生不断增长的变换。有人能帮我吗?提前感谢您的帮助,以下是我的代码:

CGRect fullview = CGRectMake(59, 102, 650, 150);
CGRect iconView = CGRectMake(59, 102, 290, 150);
CGRect textView = CGRectMake(349, 102, 360, 150);

[_profileBtn setEnabled:FALSE];
[_profileBtn setHidden:TRUE];
[UIView animateWithDuration:1 animations:^{  // animate the following:

    _profileIcon.frame = iconView; // move to new location
    _profileText.frame = textView; // move to new location
    _profileBackground.frame =fullview;

}completion:^(BOOL finished){
    [UIView animateWithDuration:1 animations:^{  // animate the following:           
        _profileBackground.transform = CGAffineTransformMakeScale(1, 5.64);
    }];


}];

检查UIView变换属性的。具体来说,如果调整变换,对象的帧会发生什么变化。我认为与其在UIView的变换上执行第二个动画,不如将其应用于其层变换的比例。

我找到了一个接近我想要的解决方案。这将同时进行平移和移动:

    CGRect iconView = CGRectMake(59, 102, 290, 150);
    CGRect textView = CGRectMake(349, 102, 360, 150);
    _profileIcon.frame = iconView; // move to new location
    _profileText.frame = textView; // move to new location
    CGAffineTransform scale = CGAffineTransformMakeScale(1, 5.00);
    CGRect fullview = CGRectMake(59, 40, 650, 150);
    _profileBackground.frame = CGRectApplyAffineTransform(fullview,scale);

看了文档之后,我仍然不知道我是否得到了它。你能给我举一个你在代码中谈论的例子吗?