Latest 0.1.0
Homepage https://github.com/zzdjk6/ZZScale
License MIT
Platforms ios 8.0
Authors

[![CI Status](http://img.shields.io/travis/Chen Shenghan/ZZScale.svg?style=flat)](https://travis-ci.org/Chen Shenghan/ZZScale)
Version
License
Platform

Introduce

Have you face the problem that you only got 1 set of design from your designer, but you have to adapt multiple screens?

Yes, you can do everything by auto-layout or manually code layout, but you have to define a lot of strategies for all places that need to be care when adapt for differnt screen size.

Is there a much simpler way to do that? Yes, I provide a solution: ZZScale.

This is how it works:

  1. Scale your container view by ratio, either by width or height, when viewDidLoad
  2. You treat the layout just like in your designed screen size, if the runtime screen size is the same ratio as your designed screen size.
  3. When runtime screen size is not the same ratio as your designed screen size, it scales by the priority side (width or height), and leave the other side for further layout method.
  4. And yes, it works with auto-layout!

Here is an example:

You have a scrollable screen that you want all users to see it in just same horizontal layout of iPhone6 in every devices, you can just insert the code self.view.zz_scaleInFactorRelativeByWidth(375) in viewDidLoad of your UIViewController.

Here is another example:

You have a non-scrollable screen that you want all users to see it in just same vertical layout of iPhone6 in every devices, you can just insert the code self.view.zz_scaleInFactorRelativeByHeight(667) in viewDidLoad of your UIViewController.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

ZZScale is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "ZZScale"

Author

Chen Shenghan, [email protected]

License

ZZScale is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "ZZScale",
    "version": "0.1.0",
    "summary": "ZZScale is a handy tool for those who need really simple multi-screen adapt solutions",
    "description": "Have you face the problem that you only got 1 set of design from your designer, but you have to adapt multiple screens?nnYes, you can do everything by auto-layout or manually code layout, but you have to define a lot of strategies for all places that need to be care when adapt for differnt screen size.nnIs there a much simpler way to do that? Yes, I provide a solution: ZZScale.nnThis is how it works:nn1. Scale your container view by ratio, either by width or height, when `viewDidLoad`n2. You treat the layout just like in your designed screen size, if the runtime screen size is the same ratio as your designed screen size.n3. When runtime screen size is not the same ratio as your designed screen size, it scales by the priority side (width or height), and leave the other side for further layout method.n4. And yes, it works with auto-layout!nnHere is an example:nnYou have a scrollable screen that you want all users to see it in just same horizontal layout of iPhone6 in every devices, you can just insert the code `self.view.zz_scaleInFactorRelativeByWidth(375)` in `viewDidLoad` of your `UIViewController`.nnHere is another example:nnYou have a non-scrollable screen that you want all users to see it in just same vertical layout of iPhone6 in every devices, you can just insert the code ` self.view.zz_scaleInFactorRelativeByHeight(667)` in `viewDidLoad` of your `UIViewController`.",
    "homepage": "https://github.com/zzdjk6/ZZScale",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Chen Shenghan": "[email protected]"
    },
    "source": {
        "git": "https://github.com/zzdjk6/ZZScale.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "ZZScale/Classes/**/*"
}

Pin It on Pinterest

Share This