DDRichText 1.0.0

DDRichText 1.0.0

测试已测试
语言 Obj-CObjective C
许可证 自定义
发布最后发布2015年5月

David Day 维护。



  • 作者:
  • David Day

此框架是从 https://github.com/TigerWf/WFCoretext 分支出来的。就像微信朋友圈和微博富文本。在原始库的基础上增加了许多新功能,使其更容易使用

演示快照

github

设置

  • 将 DDRichTextLib 复制到您的项目中
  • 当您想要像这样使用 DDRichText 时

    #import "DDRichTextViewController.h"
    
  • 享受它

使用

  • 首先,您应该创建一个 viewController 并让它继承 DDRichTextViewController 并实现 DDRichTextViewDataSource,DDRichTextViewDelegate
  • 其次,在您的 viewController 中添加

    self.delegate = self;
    self.dataSource = self;
    

*第三步,您需要创建一个继承自 YMTextData 的数据模型

    YMTextData *ymData = [[YMTextData alloc] init];
    ymData.showImageArray = _imageDataSource;
     ymData.foldOrNot = YES;
    ymData.showShuoShuo = @"this is contents";
    ymData.replyDataSource = _replyDataSource;
    ymData.name = @"David";
    ymData.intro = @"2015-2-8";
    ymData.headPic = [UIImage imageNamed:@"1.png"];
  • 最后完成 dataSource 和 delegate 方法,就像使用 UITableView 一样

    //@required
    -(YMTextData *)dataForRowAtIndex:(NSInteger)index{
    return [ymDataArray objectAtIndex:0];
    }
    
    -(NSInteger)numberOfRowsInDDRichText{
    return 5;
    }
    
    -(NSString *)senderName{
    return @"David";
    }
    
    //@optional
    -(BOOL)hideReplyButtonForIndex:(NSInteger)index;//hide replyButton
    -(void)didPromulgatorPressForIndex:(NSInteger)index name:(NSString*)name;//the publisher head was being pressed
    -(void)didRichTextPressedFromText:(NSString*)text index:(NSInteger)index;//the contents was being pressed
    -(void)didRichTextPressedFromText:(NSString*)text index:(NSInteger)index replyIndex:(NSInteger)replyIndex;//the reply was being pressed
    -(void)replyForIndex:(NSInteger)index replyText:(NSString*)text;//reply text callback       
    

由谁创建

  • David Day(daiweilai)

许可证

版权 David Day(daiweilai)

根据 Apache 许可证第 2 版("许可证")进行许可;除非根据许可证文件明示或书面同意,否则不得使用此文件。您可以在以下位置获得许可证副本:

   https://apache.ac.cn/licenses/LICENSE-2.0

除非适用法律要求或书面同意,否则在许可证下分发的软件按"现状"基础分发,不提供任何明示或暗示的保证或条件。有关许可证的具体语言和控制许可权限和限制,请参阅许可证。