Error while using property 'CGRectGetWidth', it says it was replaced with 'CGRect.width'

后端 未结 2 1707
孤城傲影
孤城傲影 2021-01-22 14:35

When I\'m using this code, I get an error:

let d = translation.x / CGRectGetWidth(pan.view!.bounds) * 0.5

\'CGRectGetWidth\' has

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-22 15:07

    You should get the width directly from the bounds property.

    let d = translation.x / pan.view!.bounds.width * 0.5
    

提交回复
热议问题