You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.0 KiB

//
// TYTextStorageProtocol.h
// TYAttributedLabelDemo
//
// Created by tanyang on 15/4/8.
// Copyright (c) 2015年 tanyang. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef enum : NSUInteger {
TYDrawAlignmentTop, // 底部齐平 向上伸展
TYDrawAlignmentCenter, // 中心齐平
TYDrawAlignmentBottom, // 顶部齐平 向下伸展
} TYDrawAlignment;
extern NSString *const kTYTextRunAttributedName;
@protocol TYTextStorageProtocol <NSObject>
@required
/**
* appendStorage,range只针对追加的文本
*/
@property (nonatomic,assign) NSRange range;
/**
* ,
*/
@property (nonatomic,assign) NSRange realRange;
/**
* attributedString addTextStorage调用
*
* @param attributedString
*/
- (void)addTextStorageWithAttributedString:(NSMutableAttributedString *)attributedString;
@end
@protocol TYAppendTextStorageProtocol <TYTextStorageProtocol>
@required
/**
* attributedString属性 appendTextStorage调用
*
* @return attributedString属性
*/
- (NSAttributedString *)appendTextStorageAttributedString;
@end
@protocol TYLinkStorageProtocol <TYAppendTextStorageProtocol>
@property (nonatomic, strong) UIColor *textColor; // 文本颜色
@end
@protocol TYDrawStorageProtocol <TYAppendTextStorageProtocol>
@property (nonatomic, assign) UIEdgeInsets margin; // 四周间距
/**
* View
*
* @param rect
*/
- (void)drawStorageWithRect:(CGRect)rect;
/**
*
*/
- (void)setTextfontAscent:(CGFloat)ascent descent:(CGFloat)descent;
// 当前替换字符数
- (void)currentReplacedStringNum:(NSInteger)replacedStringNum;
@end
@protocol TYViewStorageProtocol <NSObject>
/**
* view
*/
- (void)setOwnerView:(UIView *)ownerView;
/**
*
*/
- (void)didNotDrawRun;
@end