美文网首页iOS Developer
集富文本 自定义弹框 自定义textView于一体的LLKit

集富文本 自定义弹框 自定义textView于一体的LLKit

作者: 奥卡姆剃须刀 | 来源:发表于2016-10-17 16:49 被阅读330次

    文章目录导航

    AddClickButton -- 扩大按钮的点击区域
    LLLabel -- 实现富文本一句话调用
    LLPlaceholderTextView -- 自定义TextView 祝你快速开发
    LLAlertViewAnimation -- 自定义弹框 一句话调用
    Hope

    有什么问题可留言 本人第一时间解答问题
    有喜欢的可动动小指头点赞
    GitHub地址:https://github.com/liuniuliuniu/LLKit

    LLKit.gif

    <a id="AddClickButton"></a>AddClickButton

    本类用户扩大按钮的点击区域,按照官方建议不小于44 point

    使用方法: 创建的按钮直接继承自AddClickButton即可

    <a id="LLLabel"></a>LLLabel

    本类用于实现富文本

    使用方法: 继承自LLLabel

            
        self.textLabel.text = @"#豆姐在现场#高亮显示高亮显示高亮显示高亮显示 @杨幂: 纽约[飞机]上海到达。女王荣耀归来! 微博链接:http://weibo.com/yangmiblog?refer_flag=1001030101_, 协议《一二一》 ,杨幂专属定制 杨幂驾到高亮显示高亮显示高亮显示";
        // 非匹配内容文字颜色
        self.textLabel.LL_commonTextColor = [UIColor darkGrayColor];
        
        // 点选高亮颜色
        self.textLabel.LL_textHightLightBackGroundColor = [UIColor lightGrayColor];
        
        // 匹配用户名
        [self.textLabel setHightLightTextColor:[UIColor orangeColor] forHandleStyle:HandleStyleUser];
        // 匹配标题
        [self.textLabel setHightLightTextColor:[UIColor yellowColor] forHandleStyle:HandleStyleTopic];
        // 匹配链接
        [self.textLabel setHightLightTextColor:[UIColor purpleColor] forHandleStyle:HandleStyleLink];
        // 匹配协议《》
        [self.textLabel setHightLightTextColor:[UIColor greenColor] forHandleStyle:HandleStyleAgreement];
        
        // 自定义的文字
        self.textLabel.LL_matchArr = @[
                                       @{
                                           @"string":@"高亮显示",
                                           @"color":[UIColor magentaColor]
                                           },
                                       @{
                                           @"string":@"女王荣耀归来",
                                           @"color":[UIColor magentaColor]
                                           }
                                       ];
            
        // 可以使用block 打印的字符串
        self.textLabel.LL_tapOperation = ^(UILabel * label, HandleStyle style, NSString * selectedString, NSRange range) {
            
            NSLog(@"block--%@",selectedString);
            
            //        if (style == HandleStyleLink) {
            //            LLWebViewController *webVC = [LLWebViewController new];
            //            webVC.urlString = selectedString;
            //            [self.navigationController pushViewController:webVC animated:YES];
            //        }
            
        };
        
        self.textLabel.delegate = self;
        
    }
    
        // 也可以使用delegate 打印字符串
    #pragma LLLabelDelegate
    - (void)LL_label:(LLLabel *)label didSelectedString:(NSString *)selectedStr forStyle:(HandleStyle)style inRange:(NSRange)range{
        NSLog(@"LLLabelDelegate----%@",selectedStr);
    }
    
    

    <a id="LLPlaceholderTextView"></a>LLPlaceholderTextView

    本类用于自定义TextView 添加placeholderString 并能动态根据文本更改高度

    使用方法: 继承自LPlaceholderTextView

    <a id="LLAlertViewAnimation"></a>LLAlertViewAnimation

    本类用于自定义弹框 只需要将customView赋值给ContentView即可
    
        LLAlertViewAnimation *alertV = [LLAlertViewAnimation new];
        
    //  将自定的View赋值给alertV的contentView上
        alertV.contentView = self.customV;
        
    //  弹框是否包含动画 默认是yes
        alertV.isAnim = NO;
        
        [alertV show];
    
    具体使用可详见demo

    <a id="hope"></a>Hope

    • 代码使用过程中,发现任何问题,可以随时issue也可直接在简书下留言
    • 如果有更多建议或者想法也可以直接联系我 QQ:416997919
    • GitHub链接 https://github.com/liuniuliuniu/LLKit
    • 觉得框架对你有一点点帮助的,就请支持下,点个赞。

    相关文章

      网友评论

        本文标题:集富文本 自定义弹框 自定义textView于一体的LLKit

        本文链接:https://www.haomeiwen.com/subject/riqzyttx.html