apple各种型号设备对应的Size Class

iOS与iPadOS布局指南
本文介绍了不同设备和屏幕方向下的尺寸类应用原则,包括iPhone和iPad的各种屏幕尺寸及横竖屏显示设置方法,帮助开发者更好地进行适配。

可以总结为: 

  • 如果项目不支持横屏显示,使用w:Compact h:Regular(或者直接取消使用Size Class) 

  • 如果项目支持横屏显示,使用w:Compact h:Regular+w:Any h:Compact 

  • 对于一些公有的约束(任意组合中都适用),一般放在w:Any h:Any中设置 

  • iPad同理


iPhone4S,iPhone5/5s,iPhone6

竖屏:(w:Compact h:Regular)

横屏:(w:Compact h:Compact)

iPhone6 Plus

竖屏:(w:Compact h:Regular)

横屏:(w:Regular h:Compact)

iPad

竖屏:(w:Regular h:Regular)

横屏:(w:Regular h:Regular)




package com.tplink.zhaochenyu.ex2_3; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; public class test { public static void main(String[] args) throws Exception { apple apple1 = new apple(); apple1.setName("红富士"); apple1.setPrice(20); apple1.setColour("红"); apple1.setSize(10); apple apple2 = new apple(); copy(apple1, apple2, "name"); System.out.println(apple2.getName()); System.out.println(apple2.getSize()); System.out.println(apple2.getPrice()); System.out.println(apple2.getColour()); } static public void copy(Object to, Object from, String... escapeAttrs) throws Exception { Class<?> fromClass = from.getClass(); Class<?> toClass = to.getClass(); if (fromClass != toClass) { throw new IllegalArgumentException("对象类型不一致"); } ArrayList<Field> fromFields = new ArrayList<Field>(); Class<?> nowClass = fromClass; while (nowClass != null && nowClass != Object.class ){ Field[] nowClassFields = nowClass.getDeclaredFields(); Collections.addAll(fromFields, nowClassFields); nowClass = nowClass.getSuperclass(); } char tage = ' '; for (Field fromField : fromFields) { tage = ' '; String fieldName = fromField.getName(); for (String attr : escapeAttrs) { if (attr.equals(fieldName)) { tage = 'X'; break; } } if (tage == 'X') { continue; } Class<?> nowFromClass = fromClass; Class<?> nowToClass = toClass; while (nowFromClass != null && nowFromClass != Object.class && nowToClass != null && nowToClass != Object.class) { String getName = "get" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1); String setName = "set" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1); try { Method get = nowFromClass.getMethod(getName); Method set = nowToClass.getMethod(setName); Object value = get.invoke(from); set.invoke(to, value); } catch (NoSuchMethodException e) { nowFromClass = nowFromClass.getSuperclass(); nowToClass = nowToClass.getSuperclass(); } } } } }这段代码未能实现想要的效果,修复这段代码
10-25
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值