Coder Social home page Coder Social logo

screenscale's Introduction

ScreenScale

按照设计的比例适配UI

设计稿UI 针对的屏幕宽度定义在

static let screenWidth:CGFloat = 375.0

例如: 在设计稿中居左10px. 设计稿仅针对一种屏幕给出效果(如4.7寸屏), 为了再3.5寸 5.5寸上适配, 需要对居左距离进行等比缩放.

使用如下方法进行等比缩放

print("\(10.0.scale)")
print("\(Float(20.0).heightScale(width: Float(10.0)))")
print(CGSize(width: 10, height: 20).scale)

screenscale's People

Watchers

 avatar  avatar

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.