Question

When trying to animate a view using [UIView transitionWithView] the text resizes, while I don't appear to be doing anything with the font size.

The view contains three buttons. Two buttons representing 'tabs' and a single button to edit the text on those tabs. One of the tabs is disabled (to represent the active tab).

When calling:

[UIView transitionWithView:self.containerView
                  duration:0.4
                   options:UIViewAnimationOptionTransitionFlipFromLeft
                animations:^{
                    [self.leftTab setTitle:@"Foo" forState:UIControlStateNormal];
                    [self.rightTab setTitle:@"Bar" forState:UIControlStateNormal];
                completion:nil];

The text does change, but the non-disabled button, resizes its text.

I'm using UIButton setTitle:forState:] which usually works fine, but in this case I must be missing something silly. Any ideas on how to fix the resizing problem?

Was it helpful?

Solution

Silly me. The animation didn't appear on the other tab, because it was disabled. I disabled animations on the other tab by using [UIView setAnimationsEnabled:NO].

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top