Trying to implement support for Dynamic Type and have an issue. I set the style I want to use on a label or something in Interface Builder. I register for the UIContentSizeCategoryDidChangeNotification, and in the handler, I set the label's font to ... what? How do I know what style to use? Shouldn't there be an accessor that lets me find that out? If not, I have to put it in 2 places, which means they'll get out of sync and I'll be annoyed. Any thoughts?
iOS - Dynamic Type and Interface Builder
475 Views Asked by MacsimusPrime At
2
There are 2 best solutions below
0
XLE_22
On
Since iOS 10, there's no need to follow this rationale because the adjustsFontForContentSizeCategory property allows an automatic scaling of the font sizes according to the content type size selected in the settings.
All the text styles are well defined in the Apple reference site and their size variations as well.
Related Questions in IOS
- Overlapping UICollectionView in storyboard
- Cannot pod spec lint because of undeclared type errors
- Is the transactionReceipt data present in dataWithContentsOfURL?
- UIWebView Screen Fitting Issue
- ZXingObjC encoding issues
- iOS: None of the valid provisioning profiles allowed the specific entitlements
- How to hide "Now playing url" in control center
- CloudKit: Preventing Duplicate Records
- Slow performance on ipad erasing image
- Swift code with multiple NSDateFormatter - optimization
- iOS 8.3 Safari crashes on input type=file
- TTTTimeIntervalFormatter always returns strings in English
- How do I add multiple in app purchases in Swift Spritekit?
- Setup code for xibs in iOS. -awakFromNb:
- iOS Voice Over only reads out the title of any alert views
Related Questions in INTERFACE-BUILDER
- How do I customize NSOutlineView to have border color?
- How can I use AutoLayout to place view exactly above other?
- Xcode Interface Builder loading XIB file show view with transparency
- Checking if code is running in Interface Builder
- On xib, dragging view will automatically go inside a bigger view
- Trying to load a nib from interface builder
- Connecting to Superclass Properties with Storyboards
- How can I implement the scrolling found in Transit on the App Store?
- Interface builder position off screen
- Matching Xcode color space with Digital Color Meter
- Reference main NSWindow in AppDelegate using Storyboard?
- How to make a view with picker and toolbar stay at the bottom of iphone screen
- Xcode 7 beta made my apps storyboard files inaccessible
- iOS: How can I remove reference to sub-views?
- Push segue with Storyboards
Related Questions in ACCESSIBILITY
- Links with images and text - combined or separate?
- Why would an `a` tag need `tabindex=0`?
- How to set priority for screen readers of some HTML page parts?
- How to specify a general note for screen readers in html
- Adobe Reader cannot correctly read out loud table in tagged document
- Implementing accessibility in viewpager android to have a "swipe next for more" kind of thing
- Android WebView accessibility in Lollipop
- What elements receive default focus styling?
- talkback reads capital letters as a word, it should read separate
- Accessibility Check fail when using TextInputLayout
- Find all display:none attributes and add in aria-hidden attribute using JavaScript
- Inconsistent Accessibility Error #2
- event.getSource() returns null on View_Focused using Accessibility in Android
- iOS Voice Over to announce new view titles when pushed/popped on a UINavigationController
- Prevent Voiceover from reading UIAccessibility accessibilityLabel
Related Questions in DYNAMIC-TYPE-FEATURE
- Keeping texts of different sizes aligned at top as the dynamic type size increases
- Default UIFont size and weight but also support preferredFontForTextStyle
- Fixing the size of a custom font in SwiftUI iOS 13+ when ignoring Dynamic Type
- How to stop SwiftUI from changing font sizes automatically
- Dynamic Type Static UITableViewCell
- How to build square cells in a SwiftUI LazyVGrid containing dynamic type
- UITextField rightView alignment
- Is there a way to set something like adjustsfontsizetofitwidth on UITabBarItem
- How to change Dynamic Type to use different text styles
- How to make NSMutableAttributedString responsive with dynamic type text from settings app
- iOS: layout change for accessibility font sizes
- iOS Swift: UIAlertController ignores maximumContentSizeCategory
- UIImageView intrinsic content size behavior with Dynamic Type
- iOS - Dynamic Type and Interface Builder
- Add dynamic type to a UISearchBar
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I don’t think this will satisfy you, but set the font to
[UIFont preferredFontForTextStyle:UIFontTextStyleTitle2or whatever style you set in Interface Builder.Ignore the setting in Interface Builder. It’s not even worth setting. Interface Builder is a (mostly) static representation of the initial state of your views, but this is Dynamic Type.
You could subclass
UILabelto make it dynamic, and/or join us on the dark side of setting up views in code.