Skip to content

Instantly share code, notes, and snippets.

@rrenna
Last active August 29, 2015 14:10
Show Gist options
  • Save rrenna/ec2fa0dc5707d6ae4411 to your computer and use it in GitHub Desktop.
Save rrenna/ec2fa0dc5707d6ae4411 to your computer and use it in GitHub Desktop.
Example of odd UIAppearance proxy behaviour in iOS 8.1. When implemented this way, the labels used in controls which should be outside the scope of your app, like the iOS share sheet, are also modified.
// Extend UILabel with a method which sets font, to be used by UIAppearance
extension UILabel
{
func setFontName(fontName:String)
{
self.font = UIFont(name: fontName, size: self.font.pointSize)
}
}
// Somewhere in the code, call the extension method on the UIAppearance proxy object of UILabel, example:
//
// UILabel.appearance().setFontName("HandelGothicBT-Regular")
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment