iOS UIButton使用gif图片等需求

新奇的需求,记录一下

使用了SD框架,别的方法要用一堆废物代码

#import "UIImage+GIF.h"
NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"旋转跳跃" ofType:@"gif"];
NSData *imageData = [NSData dataWithContentsOfFile:imagePath];
UIImage *image = [UIImage sd_imageWithGIFData:imageData];
[loveSongBtn setImage:image forState:UIControlStateNormal];

UILabel添加阴影

    NSShadow *shadow = [[NSShadow alloc]init];
    shadow.shadowBlurRadius = 2;
    shadow.shadowOffset = CGSizeMake(0, 0);
    shadow.shadowColor = [UIColor blackColor];
    NSAttributedString *art = [[NSAttributedString alloc]initWithString:@"qweqweqwe" attributes:@{NSShadowAttributeName:shadow}];
   _label.attributedText = art;
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。