Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marker设置centerOffset参数之后,自定义view失效,只显示默认的大头针图标 #758

Open
yzw0525 opened this issue Aug 18, 2022 · 7 comments

Comments

@yzw0525
Copy link

yzw0525 commented Aug 18, 2022

  • 使用的版本3.1.1、
  • RN 版本0.63.3、
  • 设备信息 ios15.5

C77FD0EC-0F90-4609-A99C-6F7D0216B518

Marker设置centerOffset参数之后,自定义view失效,只显示默认的大头针图标

@KumoCloud0-0
Copy link

一样的问题

@yzw0525
Copy link
Author

yzw0525 commented Oct 29, 2022

@qiuxiang 有解决方案吗

@wine1
Copy link

wine1 commented Feb 15, 2023

请问这个问题 大家都是怎么解决的呢

@wine1
Copy link

wine1 commented Feb 16, 2023

func update() {
if view != nil {
iconView?.layer.opacity = 1
let renderer = UIGraphicsImageRenderer(bounds: iconView!.bounds)
view?.image = renderer.image { context in layer.render(in: context.cgContext) }
iconView?.layer.opacity = 0
updateCenterOffset()
}
}

func updateCenterOffset() {
if centerOffset == nil, view != nil {
let size: CGSize = (view?.image.size)!
view?.centerOffset = CGPoint(x: 0, y: -size.height / 2)
}
if centerOffset != nil {
view?.centerOffset = centerOffset!
}
}

我改了源码 但总归不是长久之计 我自己看下来不会引起啥问题 希望大佬可以看一下 没问题的话最好能优化一下 这样改可能引起别的问题的话也请指出 谢谢大佬🙏~

@qiuxiang
Copy link
Owner

我得花点时间来做测试,以前的代码基本也忘差不多了

@cashon1120
Copy link

这确实是个问题啊,我加了centerOffset不显示图片,也不显示大头针

@cashon1120
Copy link

cashon1120 commented Apr 1, 2023

有个笨方法就是延迟加上centerOffset属性,图片会抖动一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants