SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
iOS/UILabel+LockFonts.m
1 #import "UILabel+LockFonts.h"
2 #import <objc/runtime.h>
3
4 @implementation UILabel (LockFonts)
5
6 - (void)setLocksFonts:(bool)locksFont
7 {
8 objc_setAssociatedObject(self, @selector(locksFonts), @(locksFont), OBJC_ASSOCIATION_RETAIN);
9 }
10
11 - (bool)locksFonts
12 {
13 return [objc_getAssociatedObject(self, _cmd) boolValue];
14 }
15
16 - (void)setFontHook:(UIFont *)font
17 {
18 if (self.locksFonts) return;
19 [self setFontHook:font];
20 }
21
22 + (void)load
23 {
24 method_exchangeImplementations(class_getInstanceMethod(self, @selector(setFontHook:)),
25 class_getInstanceMethod(self, @selector(setFont:)));
26
27 }
28
29 @end
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.