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

后端 未结 2 1701
孤城傲影
孤城傲影 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 14:57

    CGRectGetWidth has been removed in swift 3 and now you can get width directly

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

    hope its works..

    0 讨论(0)
  • 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
    
    0 讨论(0)
提交回复
热议问题