I am trying to construct a button using the new iOS15 button API. (Xcode 13ß3, UIKit & Storyboards)
The button has a title (aligned .leading) and an image (aligned .trailing). The button has the following layout constraints:
- a fixed leading constraint (to a label that provides prompt text)
- a center-vertically constraint (to that same label)
- a trailing constraint ( >= a margin value)
What I’m trying to accomplish is that the button should adjust its width based on the title content, not wrapping until the width causes the trailing constraint to be violated.
What actually happens is the the button’s text wraps. It acts as if it prefers wrapping to changing its size.
There are mentions in the documentation about disabling text wrapping for the button, but the obvious things, such as
button.titleLabel?.lineBreakMode = .byTruncatingMiddle
don’t work.
Has anyone whose tried working with iOS 15 buttons have any suggestions?