GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - NBkiller/customerFont: 自定义字体

BranchesTags
Open more actions menu

Latest commit

 

History

4 Commits
4 Commits

Folders and files

NameName
Last commit message
Last commit date
customerFont.xcodeproj
customerFont.xcodeproj
 
 
customerFont
customerFont
 
 
customerFontTests
customerFontTests
 
 
customerFontUITests
customerFontUITests
 
 
README.md
README.md
 
 
STXIHEI.TTF
STXIHEI.TTF
 
 

Repository files navigation

customerFont

更换系统自带的字体,自定义字体及动态改变

注:我们项目是在后面才有更换字体的需求,所以都是用到的systemFontOfSize:方法,而不是是fontWithName: size:方法, 所以要全部跟换的话,就需要所有都换,工作量非常大啊,所以想到了运行时。

+(void)load {
Method originalMethod = class_getClassMethod([UIFont class], @selector(systemFontOfSize:)); 
Method swizzledMethod = class_getClassMethod([UIFont class], @selector(fontWithNameAndSize:)); 
method_exchangeImplementations(originalMethod, swizzledMethod); 
}

+(UIFont *)fontWithNameAndSize:(CGFloat)fontSize { 
NSLog(@"fontWithNameAndSize"); 
return [UIFont fontWithName:@"STHeitiTC-Light" size:fontSize];

}

About

自定义字体

Resources

Readme
Activity

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.