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;

你可能感兴趣的:(iOS UIButton使用gif图片等需求)