我展开并移动了一个标签(instructionLabel),然后将其恢复为原始大小,但将其保留在新位置。
[UIView animateWithDuration:0.5
animations:^{
CGAffineTransform scale = CGAffineTransformMakeScale(2.0, 2.0);
CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, -70.0); // up 70
self.instructionsLabel.transform = CGAffineTransformConcat(scale,translate);
}
completion:^(BOOL finished) {
[UIView animateWithDuration:0.25
animations:^{
CGAffineTransform scale = CGAffineTransformMakeScale(1.0,1.0);
CGAffineTransform translate = CGAffineTransformMakeTranslation(0,-70.0); //left in place up 70
self.instructionsLabel.transform = CGAffineTransformConcat(scale, translate);
}
completion:^(BOOL finished) {}
];
后来,我明确地使用 CGPointMake 将标签放回原来的位置,但它仍然在翻译位置(从原来的位置高出 70 点)。
instructionsLabel.frame = CGRectMake(384, 601, 655, 40);
//Adding this doesn't make any difference, in or out.
instructionsLabel.center=CGPointMake(384, 601);
我已经通过 Breaks 和 NSLog 验证了 CGPointMake 和 CGRectMake 语句已达到......在仿射变换之后它们只是不起作用。有谁知道为什么?(我不想在翻译例程之后立即将标签移回,但如果我无法弄清楚为什么 CGPointMake 例程不这样做,我可能不得不这样做。)
感谢您的任何建议。-抢