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,257評論 4 61
  • Spring Cloud為開發人員提供了快速構建分布式系統中一些常見模式的工具(例如配置管理,服務發現,斷路器,智...
    卡卡羅2017閱讀 134,993評論 19 139
  • Swift版本點擊這里歡迎加入QQ群交流: 594119878最新更新日期:18-09-17 About A cu...
    ylgwhyh閱讀 25,573評論 7 249
  • 每個人都有一些特別的日子值得紀念。于我而言,二零零二年的五月十三日極其難忘。兩個原因:一,我最愛的女兒是日抓周。二...
    楊昌林閱讀 448評論 1 0
  • 等你十載候你十個春夏換來的是無言的對白我苦苦追尋苦苦守候的日子已化為烏有隨風飄散心底的火苗已轉瞬即逝 我無淚我無痛...
    玥萱兒閱讀 163評論 0 0