UIButton富文本标题下系统字体消失及IB设置方法咨询
I’ve run into this exact issue before—switching a UIButton’s title to attributed text makes the familiar system font picker seem to disappear, but it’s just hiding in plain sight! Here’s how to get it back and set up your attributed title with system font directly in Interface Builder:
Quickest Trick: Convert Existing Plain Text to Attributed
This is my go-to method because it preserves your existing system font settings automatically:
- With your UIButton selected, stay in the Attributes Inspector and set the Title type to Plain first.
- Make sure the font is set to the system font you want (e.g., System 17.0, System Bold 17.0) using the regular font picker.
- Right-click on the button’s title text field (in the Attributes Inspector, where you edit the title) and select Convert to Attributed Text.
- Now your title is attributed, and it retains the original system font without you having to hunt for it.
If You Need to Manually Select System Font in Attributed Mode
If you’re starting fresh with attributed text:
- Switch the Title type to Attributed and select all the text in the title field.
- Click on the font selector (the box showing the current font name/size) to open the full font panel.
- In newer Xcode versions, look for the System Font option at the top of the panel—it’s often grouped with quick presets like "Headline" or "Body".
- If you don’t see that, use the left sidebar to navigate to the System category, where all system font variants (Regular, Medium, Bold, etc.) are listed.
- For older Xcode versions, you can search directly for the internal system font name: type
.SF UI Text(for iOS) or.SF NS Text(for cross-platform projects) in the font panel’s search bar to pull up the system font family.
Matching System Font Traits
If you want to tweak the system font’s weight or style in attributed mode:
- With the text selected, open the font panel and go to the Traits section.
- Adjust the weight (Regular, Medium, Semibold, etc.) and style (italic) here—these changes will apply to the system font family, keeping it aligned with Apple’s design system.
内容的提问来源于stack exchange,提问作者ozd
相关产品推荐
相关产品推荐

