Search code examples
iosobjective-cuibuttontranslate-animation

Button translation & scale animation with two different title


I need to animate a button using translation and scale animation.I am using this code.Button title is "ADD MUSIC"

[UIView animateWithDuration:3 animations:^{
    waterMarkButton.transform = CGAffineTransformMakeScale(-1, 1);
}];

It is transform nicely, But my title also transform, but i need title "Remove" when transform.How can i do this?


Solution

  • You can animate your title as such:

    [UIView transitionWithView:waterMarkBduration:1 options:UIViewAnimationOptionTransitionFlipFromRight animations:^{
    
        [waterMarkButton setTitle:newText forState:UIControlStateNormal];
    
    } completion:nil];