IOS Rich Text

Source: Internet
Author: User

Rich Text

Http://pan.baidu.com/s/1pJnY8BL Drag the folder downloaded here into its own project into the header file #import "OHAttributedLabel.h" #import "OHParagraphStyle.h" # Import "OHTouchesGestureRecognizer.h"   introduce these 3 header files   Add coretext.framework  //Create Rich Text string    nsmutableattributedstring* attrstr = \        [nsmutableattributedstring attributedstringwithstring:\         @ "Remember, the Moonlight-stained ocean \          Do you remember, love let each other light up the night \          Why later we used silence instead of relying on the stars, gradually haze \          break away, turn back to In the first desolate waiting for loneliness, whether to find someone to fill the heart blank \          We become the world, the most familiar strangers in the future twists and turns, their own sorrow \          Only blame we love so rough, love so deep so dream woke up stranded silent wave \          but can not return to God, if at the beginning of the intersection to hold back the excited soul "]; [Attrstr settextcolor:[uicolor whitecolor]];    [attrstr settextcolor:[uicolor RedColor] Range:NSMakeRange ( 9,4)];    [Attrstr settextisunderlined:yes Range:nsmakerange (9, 4)];    [Attrstr SettextcoLor:[uicolor Greencolor] Range:nsmakerange (125,30)];//set style     ohparagraphstyle* Paragraphstyle = [ Ohparagraphstyle defaultparagraphstyle];    paragraphstyle.textalignment = kcttextalignmentleft;    Paragraphstyle.linebreakmode = kctlinebreakbywordwrapping;    Paragraphstyle.firstlineheadindent = 0.F; Indentation for first line    paragraphstyle.linespacing = 3.F; Increase space between lines by 3 points    [Attrstr setparagraphstyle:paragraphstyle];    &N bsp;   //Initialize Rich Text label    Ohattributedlabel *label = \        [[Ohattributedlabel Alloc] Initwithframe:cgrectmake (0, 0, $)];    Label.attributedtext = attrstr;    Label.center = self.view.center;       //Add into the main view     [Self.view Addsubview:label]; The following is Zhang code   Http://www.cnblogs.com/YouXianMing/p/3656900.html This is the https://github.com/daktales/UIFontWDCus that sets the rich text fontTomloader need to drag the two folders downloaded here into the project   what font you want to use to download the font from the Web to remember that it must be a TTF format file Oh   Drag into the project and then introduce the header file and then get the font URL   Register the font Set the font style effect as follows specific demo please check desktop • Backup demo FontStyle RELATED LINKS have http://www.cnblogs.com/YouXianMing/p/3656900.html thank bloggers for sharing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.