I want to set AttributeString on the storyboard.
letattributedText=NSMutableAttributedString(string: "Hello, I am", attributes: [NSAttributedStringKey.font:UIFont.systemFont(ofSize:17)])
and the source implemented AttributedString, but I realized that it could be configured on the storyboard.
However, there is a problem and systemFont does not appear in FontFamily.Why is this?
"If the type of text is ""Plain"", you can select it without any problems, but if it is ""Attributed"", which one should I select to become ""systemFont""?"
The iOS system font is San Francisco Pro.This font was created by Apple for iOS, macOS, and tvOS, also known as Apple Font.
In my environment, when I select "Recently Used" in the "Collection" in the small window where I select fonts, "System Font 25.0" appears.If you select this, it becomes a system font.You can also change the size.I don't know why this came out, but if Arthur's environment also has this, you can choose it.There may not be any.
The font that can be set to Attributed String on the Story Board is the font that is installed on the macOS that contains the Xcode.You can check the font in the app called Font Book, which is in macOS from the beginning.There is no San Francisco there.
If you really want to use it on the Storyboard, it would be good to add San Francisco fonts that Apple distributes to macOS.
Fonts are distributed as SF Pro in https://developer.apple.com/fonts/.Once you have downloaded the font, you can install it with the Font Book app.
If you choose SF Pro Display, you should have chosen the system font.
I'm sorry, but I didn't create an app on iOS and check it, so please check it yourself.
In addition, Apple recommends using UIFont. preferredFont, which is off the question.This is a set of fonts called Body or Title, and you can easily choose from Attributed or StoryBoard.It is difficult to handle because the size changes dynamically to reflect the size of the characters you specified in the settings, but I think usability will improve.
I hope you will consider it.
I'm not sure why I can't select the system font normally, but I was able to specify it using the following methods:
© 2024 OneMinuteCode. All rights reserved.