美文网首页
iOS修改锚点后重置frame

iOS修改锚点后重置frame

作者: rocky_tt | 来源:发表于2020-09-27 14:18 被阅读0次

    //更改锚点

        func setViewAnchorPoint(view: UIView, anchorPoint: CGPoint) {
            view.layer.anchorPoint = anchorPoint
            view.top -= (0.5 - anchorPoint.y) * view.height
            view.left -= (0.5 - anchorPoint.x) * view.width
        }
    

    相关文章

      网友评论

          本文标题:iOS修改锚点后重置frame

          本文链接:https://www.haomeiwen.com/subject/ohxluktx.html