lixiang1994 / AttributedString

基于Swift插值方式优雅的构建富文本, 支持点击长按事件, 支持不同类型过滤, 支持自定义视图等.
MIT License
846 stars 76 forks source link

添加action事件点击范围太小 #19

Closed liangqing1028 closed 2 years ago

ripeyd commented 2 years ago

两行文字第二行可点击,点击位置偏上,要点两行文字的间隔位置才可以。

lixiang1994 commented 2 years ago

@ripeyd 可以发一下你的代码吗? 是点击位置判定不准确吗?

ripeyd commented 2 years ago

您好, 这是显示两行的Label,服务协议和隐私协议链接显示在第二行,如点击链接,点击的有效果位置在靠近第一行文字底部的位置,直接点击在链接上是无效的。 lazy var noticeLabel = Label().then{ $0.textAlignment = .center $0.numberOfLines = 0 $0.textInsets = UIEdgeInsets(top: 35, left: 0, bottom: 0, right: 0) $0.attributed.text = """ ("Log in and register means that you have read and agreed to", .font(Font11), .foreground(R.color.colorFFFFFF() ?? .white)) ("[User Agreement]", .font(FontMedium11), .foreground(R.color.colorFFFFFF() ?? .white), .action( [.background(.clear)]) { Navigator.default.show(segue: .webController(URL(string: Network.userAgreementUrl)!), sender: self) }) ("and", .font(Font11), .foreground(R.color.colorFFFFFF() ?? .white)) ("[Privacy Policy]", .font(FontMedium11), .foreground(R.color.colorFFFFFF() ?? .white), .action( [.background(.clear)]) { Navigator.default.show(segue: .webController(URL(string: Network.privacyPolicyUrl)!), sender: self) }) """

}

发件人: LEE @.> 答复: lixiang1994/AttributedString @.> 日期: 2021年11月8日 星期一 上午10:57 收件人: lixiang1994/AttributedString @.> 抄送: ripeyd @.>, Mention @.***> 主题: Re: [lixiang1994/AttributedString] 添加action事件点击范围太小 (#19)

@ripeydhttps://github.com/ripeyd 可以发一下你的代码吗? 是点击位置判定不准确吗?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/lixiang1994/AttributedString/issues/19#issuecomment-962766968, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACZ53BNO24ONJRMGHOMXKI3UK44C5ANCNFSM4TB5VFIQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

lixiang1994 commented 2 years ago

@ripeyd 你好, 请问label.textInsets属性是来自哪里?

lixiang1994 commented 2 years ago

@liangqing1028 点击范围是严格按照字形范围计算的, 如果强行加大此范围 势必会引起多个相邻的范围之间重叠问题. 如果你遇到了正常范围内无法正确点击的情况, 可以反馈给我.

ripeyd commented 2 years ago

好的,我把扩大范围去掉试试,如有问题再反馈,谢谢。

发件人: LEE @.> 答复: lixiang1994/AttributedString @.> 日期: 2021年11月25日 星期四 下午12:51 收件人: lixiang1994/AttributedString @.> 抄送: ripeyd @.>, Mention @.***> 主题: Re: [lixiang1994/AttributedString] 添加action事件点击范围太小 (#19)

@liangqing1028https://github.com/liangqing1028 点击范围是严格按照字形范围计算的, 如果强行加大此范围 势必会引起多个相邻的范围之间重叠问题. 如果你遇到了正常范围内无法正确点击的情况, 可以反馈给我.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/lixiang1994/AttributedString/issues/19#issuecomment-978833738, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACZ53BN5NVUBTW7VBSUK6ZTUNW6EBANCNFSM4TB5VFIQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.