Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

What does the title of a uibutton mean?


Asked by Andi Shaffer on Dec 13, 2021 FAQ



A UIControl that receives touch events. UIButton s are generally visible and often have a text Title (UIControlState).
Similarly,
As the title's drawing rect compresses (i.e., as positive insets are added), letters get cut off with ellipses. As with imageEdgeInsets, negative values translate the text without otherwise affecting the button's layout.
In this manner, The insets apply padding to the content of the button, and they're taken into account in the button's instrinsicContentSize (which was what I expected). With negative contentEdgeInsets, it's possible to get the image and text to draw outside of the button's bounds.
Also Know,
If you do not specify attributes for a particular state, the UIButton class provides a reasonable default behavior. For example, a disabled button is normally dimmed and does not display a highlight when tapped.
And,
Unfortunately, UIButton doesn't have support for NSDirectionalEdgeInsets currently, so you have to query the userInterfaceLayoutDirection to figure out whether to use the right-to-left version. Hopefully this post helps some folks wrap their heads around a weird UIKit API.