美文网首页
图片处理的函数方法

图片处理的函数方法

作者: 江湖闹士 | 来源:发表于2021-02-22 08:40 被阅读0次
如果有适配的话
+ (UIImage *)imageWithName:(NSString *)name{
     if(ios7){
          NSString *newName = [name stringByAppendingString:@“_os7"];
          UIImage *image = [UIImage imageNamed:newName];
          if(image == nil){
               image = [UIImage imageNamed:name];
return image;
          }
     }
return [UIImage imageNamed:name];
}

拉伸图片的方法
+ (UIImage *)resizedImageWithName:(NSString *)name left:(CGFloat)left top:(CGFloat)top{
     UIImage *image = [self imageWithName:name];
return [image stretchableImageWithLeftCapWidth:image.size.width * left topCapHeight:image.size.height * top];
}

相关文章

网友评论

      本文标题:图片处理的函数方法

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