vsanthanam / VSAlert

An drop-in replacement for UIAlertController with more power and better looks.
https://www.vsalert.io
MIT License
48 stars 15 forks source link

Cancel Button Font #31

Closed 942v closed 6 years ago

942v commented 6 years ago

Hi @vsanthanam

Why is it that the font for a button with style VSAlertActionStyleCancel can't be changed? You prevent that change in this 2 places:

`

}`

self.titleLabel.font = self.style == VSAlertActionStyleCancel ? [UIFont systemFontOfSize:17.0f weight:UIFontWeightSemibold] : _actionTextFont;

vsanthanam commented 6 years ago

Hi 942v.

This has to do with the relationships between action button styles. default and destructive style share a font, while cancel has its own font. default and cancel share a color, while destructive gets its own color. (this mimics the relationship between styles of UIAlertController. While the fonts and colors themselves are customizable, the relationship between them is immutable.) To change the font of a cancel style, use .cancelActionTextFont. More information is available here.

942v commented 6 years ago

Nice, thanks.

vsanthanam commented 6 years ago
screen shot 2018-06-12 at 2 19 40 pm screen shot 2018-06-12 at 2 19 49 pm

a similar behavior pattern is enforced with colors. This exists fo allow customization via UIAppearance. You can do assign [VSAlertAction appearance].actionTextFont without changing the font for cancel actions. Same with the destructive color, etc.