iOS-YYKit(控件)

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;  //设置富文本
}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 发现 关注 消息 iOS 第三方库、插件、知名博客总结 作者大灰狼的小绵羊哥哥关注 2017.06.26 09:4...
    肇东周阅读 12,198评论 4 61
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,859评论 18 139
  • Swift版本点击这里欢迎加入QQ群交流: 594119878最新更新日期:18-09-17 About A cu...
    ylgwhyh阅读 25,522评论 7 249
  • 每个人都有一些特别的日子值得纪念。于我而言,二零零二年的五月十三日极其难忘。两个原因:一,我最爱的女儿是日抓周。二...
    杨昌林阅读 439评论 1 0
  • 等你十载候你十个春夏换来的是无言的对白我苦苦追寻苦苦守候的日子已化为乌有随风飘散心底的火苗已转瞬即逝 我无泪我无痛...
    玥萱儿阅读 161评论 0 0