Ios 缩放不同屏幕尺寸的触摸点
给定一个CGPoint接触点,是否有办法缩放x、y值,使其在所有屏幕尺寸/分辨率、不同的iPad、不同的iPhone上保持一致?选择标准尺寸,将要插值的点乘以当前宽度/高度和标准宽度/高度的商Ios 缩放不同屏幕尺寸的触摸点,ios,swift,uitouch,cgpoint,Ios,Swift,Uitouch,Cgpoint,给定一个CGPoint接触点,是否有办法缩放x、y值,使其在所有屏幕尺寸/分辨率、不同的iPad、不同的iPhone上保持一致?选择标准尺寸,将要插值的点乘以当前宽度/高度和标准宽度/高度的商 guard let currentSize = (UIApplication.shared.delegate as? AppDelegate)?.window?.bounds.size else { return } let standardSize = CGSize(width: 320, h
guard let currentSize = (UIApplication.shared.delegate as? AppDelegate)?.window?.bounds.size else {
return
}
let standardSize = CGSize(width: 320, height: 568)
let point = CGPoint(x: 120, y: 120)
let interpolatedPoint = CGPoint(x: point.x * currentSize.width / standardSize.width, y: point.y * currentSize.height / standardSize.height)
你说一致是什么意思?