Git Product home page Git Product logo

dynafont's Introduction

UILabel+dynaFont用法

预设多种字体大小,支持动态切换

具体用法:

设置字体:

 UILabel *testLabel = [[UILabel alloc]init];
 设置方式一(用于设置默认字体样式[UIFont systemFontOfSize:]):
 [testLabel setDyna_fontSize:DynaFontSizeMake(10, 10, 12)];

设置方式二(用于设置自定义字体样式):
[testLabel setDyna_fontSizeBlock:^(WIFontSizeModel model) {
            int fontSize = 10;
            switch (model) {
                case WIFontSizeModelSmall: fontSize = 10;
                    break;
                case WIFontSizeModelBig: fontSize = 12;
                    break;
                default:
                    break;
            }
            [testLabel setFont:[UIFont italicSystemFontOfSize:fontSize]];//设置自定义字体
        }];

应用内全局修改字体大小:

发送大字体模式广播示例:
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:WIDynamicChangeFontSizeNotification object:@(WIFontSizeModelBig) userInfo:nil]];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.