safetotry
safetotry

Reputation: 97

What are the font attributes of the text in prefersLargeTitles property?

I'm trying to re-create the look of the prefersLargeTitles property. To that end, I was wondering if anyone can tell me the font and font size used for this property?

The reason why I'm trying to re-create this on my own is that when I hide the navigation bar in my view controller, the prefersLargeTitles property becomes automatically disabled and hidden. So the goal is to re-create this property as a custom UILabel instead.

Upvotes: 1

Views: 73

Answers (2)

Mark Thormann
Mark Thormann

Reputation: 2617

You can also get the values from the Typography section of the Human Interface Guidelines as they can vary from 31pt to 60pt depending on the user's chosen font size with Dynamic Type. There are separate tables for the base sizes:

enter image description here

and the accessibility sizes:

enter image description here

If you want to implement as a custom label for whatever reason, you can just let dynamic type do that for you rather than specifying exact point sizes as well:

mylabel.font = UIFont.preferredFont(forTextStyle: .largeTitle)

Upvotes: 0

aheze
aheze

Reputation: 30526

TL:DR

Font Color
SFUI-Bold 34.00pt labelColor

You can check using the Debug View Hierarchy.

Debug View Hierarchy

Here's all the properties:

Object

Class name Address
UILabel 0x13680d3b0

Label

Text Text Lines Behavior
Title White:0 Alpha:1 (labelColor) 1 Enabled On
Plain Text .SFUI-Bold 34.00pt Highlighted off
Aligned Natural
Baseline Line Break Min Font Scale
Align Baselines Truncate Tail 0
Highlighted Shadow Shadow Offset
nil color nil color w 0 h -1

View

Layer Layer Class Content Mode Tag Interaction
<_UILabelLayer: 0x600003cae350> _UILabelLayer Left 0 User Interaction Enabled Off, Multiple Touch Off
Alpha Background Tint
1 White:0 Alpha:0 (clearColor) R:0 G:0.48 B:1 A:1 (systemBlueColor)
Drawing
Opaque On
Hidden Off
Clears Graphics Context On
Clip To Bounds Off
Autoresize Subviews On

Accessibility (Is Accessibility Element, Not Focused)

Value Traits Elements Description Hint Identifier Actions
null Header null Title null null null

Upvotes: 1

Related Questions