1
我展开并移动了一个标签(instructionLabel),然后将其恢复到原始大小,但将其留在新的位置。仿射转换可防止CGPoint转移
[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);
我已经休息和NSLog的验证了CGPointMake和CGRectMake语句达到...他们只是不仿射变换后的工作。有谁知道为什么? (我不想在翻译过程后立即将标签移回,但如果我不知道为什么CGPointMake例程不这样做)。
感谢您的任何建议。 -Rob