Showing
1 changed file
with
16 additions
and
4 deletions
| @@ -12,8 +12,6 @@ | @@ -12,8 +12,6 @@ | ||
| 12 | **适配须知:** | 12 | **适配须知:** |
| 13 | 13 | ||
| 14 | 原版设计图的约束数值都是按照iPhone6(4.7-inch)的设计给的,在项目中都是按照iPhone5(4-inch)的数值实际使用的 | 14 | 原版设计图的约束数值都是按照iPhone6(4.7-inch)的设计给的,在项目中都是按照iPhone5(4-inch)的数值实际使用的 |
| 15 | - 例如:程序中有这样一行代码:UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100 / 2 * 0.854, 100)]; | ||
| 16 | - 适配后的代码是:UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, LayOutForScaleIPhone6P(100 / 2 * 0.854), LayOutForScaleIPhone6P(100))]; | ||
| 17 | 15 | ||
| 18 | **方法1:** | 16 | **方法1:** |
| 19 | 17 | ||
| @@ -22,7 +20,13 @@ | @@ -22,7 +20,13 @@ | ||
| 22 | **适用环境:** | 20 | **适用环境:** |
| 23 | 21 | ||
| 24 | 在没有新的设计图的情况下,项目内的参数都需要这个宏来,参数是:(按照iPhone6给的约束计算出的iPhone5的标准) | 22 | 在没有新的设计图的情况下,项目内的参数都需要这个宏来,参数是:(按照iPhone6给的约束计算出的iPhone5的标准) |
| 25 | - | 23 | + |
| 24 | +**例如:** | ||
| 25 | + | ||
| 26 | + 例如:程序中有这样一行代码: | ||
| 27 | + UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100 / 2 * 0.854, 100)]; | ||
| 28 | + 适配后的代码是: | ||
| 29 | + UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, LayOutForScaleIPhone6P(100 / 2 * 0.854), LayOutForScaleIPhone6P(100))]; | ||
| 26 | 30 | ||
| 27 | **方法名2:** | 31 | **方法名2:** |
| 28 | 32 | ||
| @@ -30,4 +34,12 @@ | @@ -30,4 +34,12 @@ | ||
| 30 | 34 | ||
| 31 | **适用环境:** | 35 | **适用环境:** |
| 32 | 36 | ||
| 33 | - 在有iPhone6P新设计图的情况下,需要使用这个宏,第一个参数是:(按照iPhone6给的约束计算出的iPhone5的标准),第二个参数是:(新的按照iPhone6P给的约束) | 37 | + 在有iPhone6P新设计图的情况下,需要使用这个宏,第一个参数是:(按照iPhone6给的约束计算出的iPhone5的标准),第二个参数是:(新的按照iPhone6P给的约束) |
| 38 | + | ||
| 39 | +**例如:** | ||
| 40 | + | ||
| 41 | + 例如:程序中有这样一行代码: | ||
| 42 | + UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100 / 2 * 0.854, 100)]; | ||
| 43 | + 新设计图的约束是width = 50 ; height = 120; | ||
| 44 | + 适配后的代码是: | ||
| 45 | + UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, LayoutForFitIPhone6P(100 / 2 * 0.854, 50), LayoutForFitIPhone6P(100, 120))]; |
-
Please register or login to post a comment