Domanda

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?

È stato utile?

Soluzione

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].

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top