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

NUDLinkAction里的url属性怎么赋值? #24

Open
vitasapple opened this issue Aug 29, 2020 · 2 comments
Open

NUDLinkAction里的url属性怎么赋值? #24

vitasapple opened this issue Aug 29, 2020 · 2 comments

Comments

@vitasapple
Copy link

make.text([NSString stringWithFormat:@"《隐私协议》",dic1[@"agreementTitle"]]).link(self,@selector(linkHandler:)).color(UIColorBlue).font(pageFontSize).attach();

在点击方法里只有获取到文字没有url,url要怎么赋值

- (void)linkHandler:(NUDAction *)action {
    if ([action isKindOfClass:[NUDLinkAction class]]) {
        NUDLinkAction *linkAction = (NUDLinkAction *)action;
        NSLog(@"%@,%@",linkAction.string,linkAction.url);//打印结果:《隐私条款》,(null)
    }    
}
@hon-key
Copy link
Owner

hon-key commented Aug 29, 2020

NUDLinkAction 的 url 字段目前并没有使用,是当初预留的。
如果你要对固定的文字做点击跳转,建议使用更灵活的 tap 方法,具体参照demo
就比如隐私协议
你可以在 linkHandler 里判断如果 string 是 《隐私协议》,就跳转到特定的h5页面中去,链接在方法里写死

- (void)linkHandler:(NUDAction *)action {
    if ([action isKindOfClass:[NUDLinkAction class]]) {
        NUDLinkAction *linkAction = (NUDLinkAction *)action;
       if ([action,string isEqualToString:@"《隐私条款》"]) {
              // 跳转到 url 如 www.baidu.com
       }
   }    
}

@vitasapple
Copy link
Author

好吧,我目前就是这样做的

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

2 participants