Latest 0.0.1
Homepage https://github.com/xtzPioneer/TXAdapter
License MIT
Platforms ios 8.0, requires ARC
Authors
  • iOS屏幕以及字体适配,支持iPhone8等机型适配。

cocoapods集成

  • pod ‘TXAdapter’, ‘~> 0.0.1’

    代码片段

/*
 注:屏幕及字体是以屏幕宽度来适配的
 */

/*真实字体大小*/
static inline CGFloat tRealFontSize(CGFloat defaultSize) {
    if ([TXAdapter shareAdapter].defaultType == tCurrentType())
        return defaultSize;
    return tScreenWidth() / [TXAdapter shareAdapter].defaultScreenWidth * defaultSize;
}

/*真实长度*/
static inline CGFloat tRealLength(CGFloat defaultLength) {
    if ([TXAdapter shareAdapter].defaultType == tCurrentType())
        return defaultLength;
    return tScreenWidth()/[TXAdapter shareAdapter].defaultScreenWidth * defaultLength;
}

使用方法

  • 导入头文件 直接使用tRealLength()、tRealFontSize()…即可
    UIView * view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, tRealLength(50), tRealLength(50))];

Latest podspec

{
    "name": "TXAdapter",
    "version": "0.0.1",
    "summary": "u9002u914diOSu5c4fu5e55u4ee5u53cau5b57u4f53",
    "description": "u9002u914diOSu5c4fu5e55u4ee5u53cau5b57u4f53uff0cu517cu5bb9iPhone8u7b49u8bbeu5907u3002",
    "homepage": "https://github.com/xtzPioneer/TXAdapter",
    "license": "MIT",
    "authors": {
        "zhangxiong": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/xtzPioneer/TXAdapter.git",
        "tag": "0.0.1"
    },
    "source_files": "TXAdapter/**/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This