GithubHelp home page GithubHelp logo

Comments (1)

lele8446 avatar lele8446 commented on May 29, 2024

CJLabel不支持NSTextAttachment的插入,但它提供比Attachment更灵活的展示方式,使用以下方法拼装数据源即可

/**
 在指定位置插入任意UIView
 
 注意!!!
 1、插入任意View, 如果设置 NSParagraphStyleAttributeName 属性,
    请保证 paragraph.lineBreakMode = NSLineBreakByCharWrapping,不然当Label的宽度不够显示内容或view时,不会自动换行, 部分view将会看不见
    默认 paragraph.lineBreakMode = NSLineBreakByCharWrapping
 2、插入任意View,如果 configure.isLink = YES,那么将优先响应CJLabel的点击响应
 
 @param attrStr       源字符串
 @param view          需要插入的view(包括UIImage,NSString图片名称,UIView)
 @param size          view的显示区域大小
 @param loc           插入位置
 @param lineAlignment 插入view所在行,与文字在垂直方向的对齐方式(只针对当前行)
 @param configure     链点配置
 @return              NSAttributedString
 */
+ (NSMutableAttributedString *)insertViewAtAttrString:(NSAttributedString *)attrStr
                                                 view:(id)view
                                             viewSize:(CGSize)size
                                              atIndex:(NSUInteger)loc
                                        lineAlignment:(CJLabelVerticalAlignment)lineAlignment
                                            configure:(CJLabelConfigure *)configure;

from cjlabel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.