MRJAttributedMarkup 0.1.3.6

MRJAttributedMarkup 0.1.3.6

YHJ维护。



MRJAttributedMarkup

CI Status Version License Platform

示例

    NSDictionary *style = @{@"body":[UIFont fontWithName:@"HelveticaNeue" size:18.0],
                             @"bold":[UIFont fontWithName:@"HelveticaNeue-Bold" size:18.0],
                             @"red": [UIColor redColor]};
    
    
    NSDictionary *style1 = @{@"body" :
                                 @[[UIFont fontWithName:@"HelveticaNeue-Bold" size:18.0],
                                   [UIColor darkGrayColor]],
                             @"u": @[[UIColor blueColor],
                                     @{NSUnderlineStyleAttributeName : @(kCTUnderlineStyleSingle|kCTUnderlinePatternSolid)}
                                     ],
                             @"thumb":[UIImage imageNamed:@"thumbIcon"]};
    
    NSDictionary *style2 = @{@"body":[UIFont fontWithName:@"HelveticaNeue" size:22.0],
                             @"help":[MRJAttributedStyleAction styledActionWithAction:^{
                                 NSLog(@"Help action");
                             }],
                             @"settings":[MRJAttributedStyleAction styledActionWithAction:^{
                                 NSLog(@"Settings action");
                             }],
                             @"link": [UIColor orangeColor]};
    
    
    self.label.attributedText = [@"属性 <bold>粗体</bold> <red>红色</red> 文本" attributedStringWithStyleBook:style];
    self.label1.attributedText = [@"<thumb> </thumb> 图标 <u>下划线</u> 文本 <thumb> </thumb>" attributedStringWithStyleBook:style1];
    self.label2.attributedText = [@"点击 <help>这里</help> 显示帮助或者 <settings>这里</settings> 显示设置" attributedStringWithStyleBook:style2];

显示

安装

MRJAttributedMarkup可通过CocoaPods获得。为了安装它,只需将以下行添加到您的Podfile中

pod 'MRJAttributedMarkup'

作者

[email protected][email protected]

许可证

MRJAttributedMarkup可在MIT许可证下使用。有关更多信息,请参阅LICENSE文件。