,可以通过以下步骤实现:
let screenWidth = UIScreen.main.bounds.width
let screenHeight = UIScreen.main.bounds.height
let viewWidth = view.frame.size.width
let viewHeight = view.frame.size.height
let aspectRatioWidth = viewWidth / screenWidth
let aspectRatioHeight = viewHeight / screenHeight
let originX = view.frame.origin.x
let originY = view.frame.origin.y
综上所述,使用宽高比到屏幕大小的iOS获取UIView原点的步骤包括获取屏幕的宽度和高度,获取UIView的宽度和高度,计算宽高比,以及获取UIView的原点坐标。
领取专属 10元无门槛券
手把手带您无忧上云