iosswiftfontsuiprintinteractioncntrler

Change font of UIPrintInteractionController


I have a UIPrintInteractionController that is created programatically. It is set to pull a pdf from my servers, and print said pdf. My question is how can I change the font of the view. I already have set the navbar font in my app delegate (so the font appears on all views), but this doesn't apply to the view. Any help is greatly appreciated. Thanks!


Solution

  • I figured it out. Create an extension of UILabel like so

    extension UILabel {
        var substituteFontName : String {
            get { return self.font.fontName }
            set { self.font = UIFont(name: newValue, size: self.font.pointSize) }
        }
    }
    

    The in AppDelegate.swift, use this extension to change the font of every label in the entire application, INCLUDING the UIPrinterInteractionController.

    UILabel.appearance().substituteFontName = "Font Name Here"
    

    Killed two birds with one stone.