JSPatch下发笔记10

OC代码:

-(void)showAlertView{
    CLNNNativeAlertView *alertView=[[CLNNNativeAlertView alloc] initWithTitle:@"请接受相关协议" message:@"我同意《租赁协议》、《芝麻信用免押金额度协议》、《内啥服务条款》及东家指定的退订规则" cancelButtonTitle:@"取消" confirmTitle:@"我同意"];
    NSDictionary *linkDic1 = @{NSForegroundColorAttributeName:MAIN_COLOR,NSFontAttributeName:[UIFont systemFontOfSize:15]};
    NSDictionary *linkDic2 = @{NSForegroundColorAttributeName:YELLOW_COLOR,NSFontAttributeName:[UIFont systemFontOfSize:15]};
    NSLog(@"%@%@",linkDic1,linkDic2);
    __weak typeof(self) weakSelf=self;
    CJLabelConfigure *configure = [CJLabel configureAttributes:linkDic1 isLink:YES activeLinkAttributes:linkDic2 parameter:WEB_rent clickLinkBlock:^(CJLabelLinkModel *linkModel) {
        BrowserViewController *vc=[[BrowserViewController alloc] init];
        vc.loadMethod=linkModel.parameter;[weakSelf.navigationController pushViewController:vc animated:YES];
    } longPressBlock:nil];
    [configure setActiveLinkAttributes:linkDic1];
    alertView.messageLabel.text = [CJLabel configureAttrString:alertView.messageLabel.attributedText withString:@"《租赁协议》" sameStringEnable:YES configure:configure];
    CJLabelConfigure *configure1 = [CJLabel configureAttributes:linkDic1 isLink:YES activeLinkAttributes:linkDic2 parameter:WEB_zhima clickLinkBlock:^(CJLabelLinkModel *linkModel) {
        BrowserViewController *vc=[[BrowserViewController alloc] init];
        vc.loadMethod=linkModel.parameter;
        
        [weakSelf.navigationController pushViewController:vc animated:YES];
    } longPressBlock:nil];
    alertView.messageLabel.text = [CJLabel configureAttrString:alertView.messageLabel.attributedText withString:@"《芝麻信用免押金额度协议》" sameStringEnable:YES configure:configure1];
    CJLabelConfigure *configure2 = [CJLabel configureAttributes:linkDic1 isLink:YES activeLinkAttributes:linkDic2 parameter:WEB_terms clickLinkBlock:^(CJLabelLinkModel *linkModel) {
        BrowserViewController *vc=[[BrowserViewController alloc] init];
        vc.loadMethod=linkModel.parameter;
        [weakSelf.navigationController pushViewController:vc animated:YES];
    } longPressBlock:nil];
    alertView.messageLabel.text = [CJLabel configureAttrString:alertView.messageLabel.attributedText withString:@"《内啥服务条款》" sameStringEnable:YES configure:configure2];
    
    alertView.confirmButtonAction=^(){
        [weakSelf continuePay];
    };
    alertView.cancelButtonAction=^(){
    };
    [alertView showAlert];
}

JS代码:

require('CLNNNativeAlertView, UIColor, UIFont, BrowserViewController, CJLabel');
defineClass('NewPayController', {
            showAlertView: function() {
            var alertView=CLNNNativeAlertView.alloc().initWithTitle_message_cancelButtonTitle_confirmTitle("请接受相关协议", "我同意《租赁协议》、《芝麻信用免押金额度协议》、《内啥服务条款》及东家指定的退订规则", "取消", "我同意") ;
            var linkDic1 = {
            "NSColor":UIColor.colorWithHexString("0097F9"),
            "NSFont":UIFont.systemFontOfSize(15)
            
            };
            var linkDic2 = {
            "NSColor":UIColor.colorWithHexString("ffbb07"),
            "NSFont":UIFont.systemFontOfSize(15)
            
            };
            var weakSelf = self;
            var configure = CJLabel.configureAttributes_isLink_activeLinkAttributes_parameter_clickLinkBlock_longPressBlock(linkDic1, 1, linkDic2, "API", block("void, CJLabelLinkModel*", function(linkModel) {                                                                                                                                            var vc=BrowserViewController.alloc().init() ;
                vc.setLoadMethod(linkModel.parameter());
            weakSelf.navigationController().pushViewController_animated(vc, 1) ;
                }), null) ;
            alertView.messageLabel().setText(CJLabel.configureAttrString_withString_sameStringEnable_configure(alertView.messageLabel().attributedText(), "《租赁协议》", 1, configure));
            var configure1 = CJLabel.configureAttributes_isLink_activeLinkAttributes_parameter_clickLinkBlock_longPressBlock(linkDic1, 1, linkDic2, "API", block("void, CJLabelLinkModel*", function(linkModel) {                                                                                                                               var vc=BrowserViewController.alloc().init() ;
                vc.setLoadMethod(linkModel.parameter());
            weakSelf.navigationController().pushViewController_animated(vc, 1) ;
                }), null) ;
            alertView.messageLabel().setText(CJLabel.configureAttrString_withString_sameStringEnable_configure(alertView.messageLabel().attributedText(), "《芝麻信用免押金额度协议》", 1, configure1) );
            var configure2 = CJLabel.configureAttributes_isLink_activeLinkAttributes_parameter_clickLinkBlock_longPressBlock(linkDic1, 1, linkDic2, "API", block("void, CJLabelLinkModel*", function(linkModel) {
                                                                                                                                                                        var vc=BrowserViewController.alloc().init() ;
                                                                                                                                                                                            vc.setLoadMethod(linkModel.parameter());
                                                                                                                                                                                            weakSelf.navigationController().pushViewController_animated(vc, 1) ;
                                                                                                                                                                                            }), null) ;
            alertView.messageLabel().setText(CJLabel.configureAttrString_withString_sameStringEnable_configure(alertView.messageLabel().attributedText(), "《内啥服务条款》", 1, configure2) );

            alertView.setConfirmButtonAction(block("void, ", function() {
                                                   weakSelf.continuePay() ;
                                                   }));
            alertView.setCancelButtonAction(block("void, ", function() {
                                                  }));
            alertView.showAlert() ;
            }}, {});

总结:NSForegroundColorAttributeName 在js中要写成"NSColor"。
获取方法为用NSLog打印,如NSFontAttribute打印出来是NSFont,则在js中写成"NSFont",注意要加双引号。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 字体属性设置示例:if(color ==nil) {color = [NSColor redColor];}NSF...
    袏扌戒指阅读 12,640评论 0 2
  • 用法: 先添加指针视图,转盘背景和开始按钮。按钮的点击事件里设置开始动画,在动画开始的代理方法中让开始按钮不响应点...
    全栈的猫南北阅读 5,569评论 1 3
  • UIView+SGFrame.h #import @interface UIView (SGFrame) @pro...
    超越时空的思念_8a22阅读 5,834评论 1 1
  • iOS开发系列--网络开发 概览 大部分应用程序都或多或少会牵扯到网络开发,例如说新浪微博、微信等,这些应用本身可...
    lichengjin阅读 9,219评论 2 7
  • 写给了不起的孩子的第69封信—— 奋进班的孩子们: 晚上好! 今天咱们在课改课的金口才秀场上展...
    少晶阅读 2,629评论 0 0

友情链接更多精彩内容