Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- + (void)setFontName:(NSString*)fontName onObject:(id)object {
- if ([object respondsToSelector:@selector(setFont:)]) {
- UIFont* font = [UIFont fontWithName:fontName size:((UIFont *)[object font]).pointSize];
- [object setFont:font];
- }
- }
- public static func setFontRewriting(fontName: String, object: AnyObject) {
- if object.responds(to:#selector(setter: object.font)) {
- let currentFont: UIFont = object.font
- let fontToSet = UIFont(name: fontName, size: currentFont.pointSize)
- object.font = UIFont(name: fontName, size: currentFont.pointSize) //doesn't work, getting various syntax errors
- }
- }
Add Comment
Please, Sign In to add comment