UILabel Disappear From Static UITableViewCell with Dynamic Type
I changed table to a dynamic and implemented cellForRowAtIndexPath:
method to assign table label in code. This is not helped me.
Next I changed table view cell style from basic to custom. I had to add my own label and set up AutoLayout constraints in Storyboard. This is solved the issue. preferredContentSizeChanged
notification is no longed necessary.
In my cellForRowAtIndexPath
:
cell.label.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
I will file an Apple radar later. Looks like we can't use Dynamic Type with static tables.
Good luck and please implement Dynamic Type in your apps. It's worth it.
I recently played with static tables and tried to add dynamic type to it. I got the same results as you - one even can see this vanishing label in Apple's own Contacts.app.
Even after changing my table from static to dynamic and implementing a small custom cell containing a UILabel (configured with font as UIFontTextStyleBody in the XIB) the table still didn't seem to update its contents when changing the preferred text size in system prefrences.
However: I accidentally got some results after doing the following: in the subclass for my custom cell I implemented prepareForReuse and re-initialize the label's font to the correct style:
- (void)prepareForReuse {
self.label.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
}
With the hack above my table cells adapt their fonts dynamically to changes in system preferences.
Hope that helps.