I am working on a UIButton subclass. at one point I want to show an activity indicator inside the button. I'm thinking I'd just animage the titleLabel over to the side a small bit like so:
(this is inside a UIButton subclass)
The title label animates over to where it should be - but then it animates back!
However, if we so something like
the label animates to where it should be and it stays there.
If I apply the above translation code to any other object, say, the button itself!
I get a more expected result tho. Is there something funny going on with UIButton subviews or am I missing something obvious?
(this is inside a UIButton subclass)
Code:
[UIView animateWithDuration:0.2 delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
self.titleLabel.transform = CGAffineTransformMakeTranslation(30, 0);
} completion:nil];
The title label animates over to where it should be - but then it animates back!
However, if we so something like
Code:
[UIView animateWithDuration:0.2 delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
self.titleLabel.transform = CGAffineTransformMakeRotation(0.4);
} completion:nil];
the label animates to where it should be and it stays there.
If I apply the above translation code to any other object, say, the button itself!
Code:
- (IBAction)buttonPressed:(id)sender {
[UIView animateWithDuration:0.2 delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
self.button.transform = CGAffineTransformMakeTranslation(-30, 10);
} completion:^(BOOL finished) {
}];
}
I get a more expected result tho. Is there something funny going on with UIButton subviews or am I missing something obvious?