当我使用此代码时,出现错误:
let d = translation.x / CGRectGetWidth(pan.view!.bounds) * 0.5
'CGRectGetWidth' has been replaced by property 'CGRect.width'
我该如何解决这个问题?
最佳答案
您应该直接从 bounds
属性获取宽度。
let d = translation.x / pan.view!.bounds.width * 0.5
关于swift - 使用属性 'CGRectGetWidth' 时出错,它说它已替换为 'CGRect.width',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48786472/