美文网首页
iOS-YYKit(控件)

iOS-YYKit(控件)

作者: 精神病患者link常 | 来源:发表于2017-12-07 18:05 被阅读54次

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-YYKit(控件)

    YYAnimatedImageView YYCache - 本地存储数据,类似NSUserDefaults YY...

  • iOS-YYKit(部分category)

    UIImage+YYAdd.h UIImageView+YYWebImage.h UIScrollView+YYA...

  • dropDownButton使用方法

    添加DropDownButton 控件添加PopuMenu控件DropDownButton控件绑定PopuMenu控件

  • Android开发之自定义View流程

    Android控件架构 ViewGroup控件和View控件,ViewGroup控件作为父控件包含了多个View,...

  • 11.7

    今天学习了列表框控件、组合框控件、单选按钮控件、复选按钮控件、分组框控件。。。。。

  • HTML5 input 新增的表单控件

    必填项验证 颜色选择控件 日期选择控件 时间选择控件 电子邮件控件:提交表单时有格式验证 数字控件 文件控件 拖拽...

  • 关于winform父子控件以及控件之间方法调用/传值

    子控件获取父控件中的其他子控件 父控件访问子控件与上述例子类似

  • 组合控件2——海贼王选项菜单

    之前的自定义控件——初识自定义控件,我们了解到了自定义控件分为三种,自制控件,组合控件,拓展控件。而我们在自制控件...

  • 11.7

    第七章的列表框控件、组合框控件、单选按钮控件、复选按钮控件、分组框控件。

  • React专题4: 组件间通信

    父控件 传值 给子控件, 父控件可以将值 赋给子控件的一个属性(属性赋值)子控件 传值 给父控件, 需要父控件将自...

网友评论

      本文标题:iOS-YYKit(控件)

      本文链接:https://www.haomeiwen.com/subject/hfkjixtx.html