BBAAttributedStringMaker.h
1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// BBAAttributedStringMaker.h
//
//
// Created by linling on 15/6/27.
// Copyright (c) 2015年 baidu. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BBAAttibutedStringAttribute.h"
@interface BBAAttributedStringImgAttachment : NSObject
@property (nonatomic, strong) UIImage *img;
@property (nonatomic, assign) CGRect bounds;
@end
/**
* 字符串属性渲染器
*/
@interface BBAAttributedStringMaker : NSObject
/**
* 待渲染的字符串
*/
@property (nonatomic, copy) NSString *needRenderString;
#pragma mark - Render Attributed
- (BBAAttibutedStringAttribute *(^)(UIColor *))color;
- (BBAAttibutedStringAttribute *(^)(UIFont *))font;
- (BBAAttibutedStringAttribute *(^)(NSTextAlignment))alignment;
- (BBAAttibutedStringAttribute *(^)(CGFloat))lineSpace;
- (BBAAttibutedStringAttribute *(^)(NSLineBreakMode))lineBreakMode;
- (BBAAttibutedStringAttribute *(^)(CGFloat))wordSpace;
- (BBAAttibutedStringAttribute *(^)(NSInteger))underline;
#pragma mark - Specify Attributed Range
- (void(^)(NSRange, void(^)(BBAAttributedStringMaker *)))range;
- (void(^)(NSString *, void(^)(BBAAttributedStringMaker *)))subString;
- (void(^)(NSUInteger, void(^)(BBAAttributedStringMaker *)))fromIndex;
- (void(^)(NSUInteger, void(^)(BBAAttributedStringMaker *)))toIndex;
- (void(^)(NSRegularExpression *, void(^)(BBAAttributedStringMaker *)))regular;
#pragma mark - UIImage attachment
- (void)imageMapWithReg:(NSRegularExpression *)expression
matcher:(BBAAttributedStringImgAttachment *(^)(NSString *codeString))matcher;
#pragma mark - Render
- (NSAttributedString *)makeRender;
@end