关于谁回复谁 label类 (第三方)

首先导入第三方类:NSMutableString+TagReplace   、NSString+WPAttributedMarkup 、 WPAttributedStyleAction 、WPTappableLabel 、WPHotspotLabel (文件见百度云盘)


第一种情况: (谁回复谁)

NSDictionary* style3 = @{@"body":[UIFont fontWithName:@"HelveticaNeue" size:12.0],

                                     @"author":[WPAttributedStyleAction styledActionWithAction:^{

                                         NSLog(@"author action");

                                         NSString *author = [tempautorInfo  objectForKey:@"userId"];

                                         [self tapCommentType1:author];

                                     }],

                                     @"toauthor":[WPAttributedStyleAction styledActionWithAction:^{

                                         NSLog(@"toauthor action");

                                         NSString *toauthor = [toAuthorInfo objectForKey:@"userId"];

                                         [self tapCommentType1:toauthor];

                                     }],

                                     @"link": [UIColor orangeColor]};

            

            NSString *authorName = [tempautorInfo objectForKey:@"nickName"];


            NSString *toauthor = [toAuthorInfo objectForKey:@"nickName"];

            if ([[[UserInfoDB defaultManger] getUserInfo:@"userId"] isEqualToString:[toAuthorInfo objectForKey:@"userId"]] == YES) {

                

                toauthor = @"";

                

            }else{

                

                toauthor = [toAuthorInfo objectForKey:@"nickName"];

                

            }

            NSString *reply = [NSString stringWithFormat:@"<author>%@</author>回复 <toauthor>%@</toauthor>",authorName,toauthor];

            cell.replyLabelName.attributedText = [reply attributedStringWithStyleBook:style3];


第二种情况(谁评论的)

 NSDictionary* style3 = @{@"body":[UIFont fontWithName:@"HelveticaNeue" size:12.0],

                                     @"author":[WPAttributedStyleAction styledActionWithAction:^{

                                         NSLog(@"author action");

                                         NSString *author = [tempautorInfo objectForKey:@"userId"];

                                         [self tapCommentType0:author];

                                     }],

                                     @"toauthor":[WPAttributedStyleAction styledActionWithAction:^{

                                         NSLog(@"toauthor action");

                                         NSString *toauthor = [toAuthorInfo objectForKey:@"userId"];

                                         [self tapCommentType0:toauthor];

                                     }],

                                     @"link": [UIColor orangeColor]};

            NSString *reply = [NSString stringWithFormat:@"<author>%@</author>" ,[tempautorInfo objectForKey:@"nickName"]];

            cell.replyLabelName.attributedText = [reply attributedStringWithStyleBook:style3];


第三种情况(谁赞了)

NSDictionary* style3 = @{@"body":[UIFont fontWithName:@"HelveticaNeue" size:12.0],

                                 @"author":[WPAttributedStyleAction styledActionWithAction:^{

                                     NSLog(@"author action");

                                     NSString *author = [tempauthorInfo  objectForKey:@"userId"];

                                     [self tapCommentType1:author];

                                 }],

                                 @"toauthor":[WPAttributedStyleAction styledActionWithAction:^{

                                     NSLog(@"toauthor action");

                                     NSString *toauthor = [commentPosts objectForKey:@"userId"];

                                     [self tapCommentType1:toauthor];

                                 }],

                                 @"link": [UIColor orangeColor]};

        

        NSString *authorName = [tempauthorInfo objectForKey:@"nickName"];

        

        NSString *reply = [NSString stringWithFormat:@"<author>%@</author>赞了",authorName];

        cell.replyLabelName.attributedText = [reply attributedStringWithStyleBook:style3];



实现点击的方法

- (void)tapCommentType1:(NSString *)userId

{

    DBLog(@"进入点赞的人的个人资料");

    UserInfoViewController *userInfoVC = [[UserInfoViewController alloc] init];

//    userInfoVC.userId = [NSString stringWithFormat:@"%ld", btu.tag - 3000];

    userInfoVC.userId = userId;

    DBLog(@"---userId=%@", userInfoVC.userId);

    [self presentViewController:userInfoVC animated:YES completion:^{

        

    }];

}





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值