I want to customize the action buttons on context menu for iOS 13+
Menus are something like this:
I thought I could set the custom font like UIAlertController actions like this:
let action = UIAction(title: "asdasd") { _ in}
let attributeString = NSMutableAttributedString(string: action.title)
attributeString.addAttributes([NSAttributedString.Key.font : font], range: NSMakeRange(0, action.title.count))
action.setValue(attributeString, forKey: "attributedMessage")
But its not work like that, so how is it?
You can't force it to use a specific font and or text size. It actually supports dynamic text. So its size will depend on the user device settings. Settings > Display & Brightness > Text Size
and Settings > Accessibility > Larger Text
(iOS 14). So yon can't use a custom font because context menu supports dynamic text. The font used by dynamic text depends on the system therefore San Francisco has been the font used by Apple since iOS 9. For more info about Dynamic Type in iOS you can read this article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With