I have a strange issue with UIButton
s inside a UIView. The view is initially constrained to a height of 0, and I'm animating the constraint using
UIView.animateWithDuration(0.6, delay: 0, options: UIViewAnimationOptions.CurveEaseInOut, animations: {
heightConstraint!.constant = height
self.view.layoutIfNeeded()
}) { (finished) in
}
This works really well, with all the content of the animated view appearing as expected, apart from any UIButtons that are placed inside.
The buttons' titleLabel
font size increases from 0 to the correct size during the animation. There's nothing special about these buttons; they are set to system font of 18, positioned relative to the superview. The button frames are correct, its just the font size that changes.
I've tried explicitly setting adjustsFontSizeToFitWidth
and contentMode
but these have no effect. Interestingly, if I add a plain UILabel
to the view, this works just fine.
Any suggestions as to what is going on?