YYAnimatedImageView
加载GIF,可以暂停和开始
- (void)YYAnimatedImageView {
animatedImageView = [[YYAnimatedImageView alloc]initWithFrame:CGRectMake(20, 100, 300, 300)];
[self.view addSubview:animatedImageView];
YYImage *image = [YYImage imageNamed:@"animalGIF"];
animatedImageView.image = image;
}
- (void)stop {
[animatedImageView stopAnimating]; // startAnimating
}
YYCache - 本地存储数据,类似
NSUserDefaults
- (void)YYCache{
// 0.初始化YYCache
YYCache *cache = [YYCache cacheWithName:@"mydb"];
// 1.缓存普通字符
[cache setObject:@"我的名字" forKey:@"name"];
// 2.取字符串
NSString *name = (NSString *)[cache objectForKey:@"name"];
NSLog(@"name: %@", name);
// 3.删除
[cache removeObjectForKey:@"name"];
// 4.是否包含
[cache containsObjectForKey:@"name"];
}
YYFileHash - 加密
@property (nullable, nonatomic, strong, readonly) NSString *md2String; ///< md2 hash string in lowercase
@property (nullable, nonatomic, strong, readonly) NSString *md4String; ///< md4 hash string in lowercase
@property (nullable, nonatomic, strong, readonly) NSString *md5String; ///< md5 hash string in lowercase
@property (nullable, nonatomic, strong, readonly) NSString *sha1String; ///< sha1 hash string in lowercase
@property (nullable, nonatomic, strong, readonly) NSString *sha224String; ///< sha224 hash string in lowercase
@property (nullable, nonatomic, strong, readonly) NSString *sha256String; ///< sha256 hash string in lowercase
@property (nullable, nonatomic, strong, readonly) NSString *sha384String; ///< sha384 hash string in lowercase
@property (nullable, nonatomic, strong, readonly) NSString *sha512String; ///< sha512 hash string in lowercase
@property (nullable, nonatomic, strong, readonly) NSString *crc32String; ///< crc32 checksum string in lowercase
@property (nullable, nonatomic, strong, readonly) NSString *adler32String; ///< adler32 checksum string in lowercase
@property (nullable, nonatomic, strong, readonly) NSData *md2Data; ///< md2 hash
@property (nullable, nonatomic, strong, readonly) NSData *md4Data; ///< md4 hash
@property (nullable, nonatomic, strong, readonly) NSData *md5Data; ///< md5 hash
@property (nullable, nonatomic, strong, readonly) NSData *sha1Data; ///< sha1 hash
@property (nullable, nonatomic, strong, readonly) NSData *sha224Data; ///< sha224 hash
@property (nullable, nonatomic, strong, readonly) NSData *sha256Data; ///< sha256 hash
@property (nullable, nonatomic, strong, readonly) NSData *sha384Data; ///< sha384 hash
@property (nullable, nonatomic, strong, readonly) NSData *sha512Data; ///< sha512 hash
@property (nonatomic, readonly) uint32_t crc32; ///< crc32 checksum
@property (nonatomic, readonly) uint32_t adler32; ///< adler32 checksum
YYLabel - 设置某个字符串可以点击
- (void)YYLabel {
YYLabel *_agressLabel = [[YYLabel alloc]initWithFrame:CGRectMake(0, 100, self.view.frame.size.width - 30, 100)];
[self.view addSubview:_agressLabel];
NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString: @"德玛西亚德玛西亚德玛西亚德玛西亚德玛西亚德玛西亚德玛西亚德玛西亚德玛西亚德玛西亚德玛西亚德玛西亚德玛西亚德玛西亚德玛西亚德玛西亚"];
text.lineSpacing = 10; // 行间距
text.font = [UIFont systemFontOfSize:14];
text.color = [UIColor blackColor];
[text setTextHighlightRange:NSMakeRange(10, 7) color:[UIColor redColor] backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
NSLog(@"被点击了");
}];
_agressLabel.numberOfLines = 0; //设置多行显示
_agressLabel.preferredMaxLayoutWidth = self.view.frame.size.width - 30; //设置最大的宽度
_agressLabel.attributedText = text; //设置富文本
}