UIButton multiple lines support

Originator:bruno
Number:rdar://48962133 Date Originated:2019-03-17
Status:Closed Resolved:Duplicate
Product:iOS + SDK Product Version:n/a
Classification:Suggestion Reproducible:n/a
 
Duplicate of 30408319.

Area:
UIKit

UIButton would benefit from proper support for multiple lines, which would allow UIButton so size itself according to the number of lines, just like UILabel does.

Currently, it's not possible to give UIButton multiple line support. It is possible to approximate it by setting the button's title label's truncation mode to 'word wrap', which will allow the button to show multiple lines.

However, this does not cause the UIButton's content size to grow or shrink for AutoLayout, which means the UIButton will always size itself as if it had only one line. This makes it significantly harder to use UIButton with larger fonts, such as when the user has Accessibility Font sizes enabled.

The lack of proper support for multiple lines causes developers to come up with different hacks around UIButton, most of which break some other aspect that is useful for the users.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!