html52.com
我爱小程序-开发者交流社区

解决微信6.7.3版本wx.createUserInfoButton的坐标问题

                let wPos = dialog.singleButton.node.convertToWorldSpaceAR(cc.Vec2.ZERO);

                let scale = (wx.getSystemInfoSync().windowWidth / (cc.view.getVisibleSize().width));

                let imgSize = cc.size(174, 80)

                let updateButton = wx.createUserInfoButton({

                    type: 'text',

                    text: "", // 不显示,空按钮

                    style: {

                        left: wPos.x - (imgSize.width / 2),

                        bottom: wPos.y - (imgSize.height / 2),

                        width: imgSize.width,

                        height: imgSize.height,

                        scale: scale,

                    }

                });

通过以上方式创建按钮,微信6.7.3版本Android系统下,只要设置style中的bottom属性就会出现按钮消失的问题,iOS正常,之前的微信版本也正常。不得不吐槽一下,一直以为坐标没算好,调了很久才发现是bottom的问题。解决方法:用top代替就没问题了

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付