UIButton: Add convenient method to modify font.

This commit is contained in:
SBiOSoftWhare 2022-03-17 16:39:05 +01:00
parent c92d1c4fd1
commit a977dff806

View file

@ -14,7 +14,7 @@
limitations under the License.
*/
import Foundation
import UIKit
extension UIButton {
@ -51,4 +51,10 @@ extension UIButton {
self.titleLabel?.adjustsFontForContentSizeCategory = newValue
}
}
/// Set title font and enable Dynamic Type support
func vc_setTitleFont(_ font: UIFont) {
self.vc_adjustsFontForContentSizeCategory = true
self.titleLabel?.font = font
}
}