-
Notifications
You must be signed in to change notification settings - Fork 0
/
STAttributedLabel.h
57 lines (34 loc) · 1.61 KB
/
STAttributedLabel.h
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
53
54
55
56
57
//
// STAttributedLabel.h
// Simple Label
//
// Created by Shawn Throop on 05/10/15.
// Copyright © 2015 Silent H Designs. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, STVerticalTextAlignment) {
STVerticalTextAlignmentTop,
STVerticalTextAlignmentMiddle,
STVerticalTextAlignmentBottom
};
// use as attribute creating NSAttributedStrings with [attribute,value]
extern NSString * const STAttributedRangeAttribute;
@interface STAttributedRange : NSObject <NSCoding>
@property (nonatomic, readonly, copy) NSString *rangeType;
@property (nonatomic, readonly) NSRange range;
@property (nonatomic, readonly) id<NSCoding> value;
- (instancetype)initWithRangeType:(NSString *)rangeType range:(NSRange)range value:(id<NSCoding>)value;
@end
typedef void (^STAttributedLabelTapHandler)(BOOL isLongPress, STAttributedRange *selectedAttributedRange);
@interface STAttributedLabel : UIView
@property (nonatomic, readonly) NSLayoutManager *layoutManager;
@property (nonatomic, readonly) NSTextStorage *textStorage;
@property (nonatomic) NSAttributedString *attributedText;
@property (nonatomic) STVerticalTextAlignment verticalTextAlignment;
@property (nonatomic) NSDictionary *selectedAttributes;
@property (nonatomic) BOOL handleLongPress;
@property (nonatomic) UIBezierPath *exclusionPath;
@property (nonatomic, copy) STAttributedLabelTapHandler tapHandler;
- (instancetype)initWithLayoutManager:(NSLayoutManager *)layoutManager textStorage:(NSTextStorage *)textStorage frame:(CGRect)frame;
- (void)setAttributes:(NSDictionary *)attributes forAttributedRangeType:(NSString *)rangeType;
@end