From the course: iOS App Development: Accessibility

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Dynamic Type, part 2: Custom fonts

Dynamic Type, part 2: Custom fonts - iOS Tutorial

From the course: iOS App Development: Accessibility

Start my 1-month free trial

Dynamic Type, part 2: Custom fonts

- [Instructor] In our last video, we added support for dynamic text to most of the labels in our app. However, these elevation view labels are not responding dynamically to changes made by the user. That's because we're using a custom font with a fixed font size for these elevation views. And if we head on in to X code, we have two classes, elevation height view and elevation length view. Let's start in ElevationLengthView.swift. On line 22, you can see that our draw rect method is responsible for drawing all the elements of this view. And if we head down to line 60, we can see that we're using a custom font calynda, with a fixed font size of 15. Instead of using that fixed font size, we want to change this to use a font style that iOS will give us. To get the point size of a font style, we just have to ask UI font for it. For these elevation views, we'll use the caption1 style and we'll ask for it's point size. And now instead of hard coding 15, we'll use our new variable. Let's do…

Contents