A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 代雄斌 中级黑马   /  2015-3-18 07:58  /  614 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

//返回一个可拉升的图片(自建的方法)
- (UIImage *)resizeImageWithImageName:(NSString *)name{
   
    UIImage *normal = [UIImage imageNamed:name];
   
    CGFloat w = normal.size.width * 0.5 - 1 ;
    CGFloat h = normal.size.height * 0.5  - 1 ;
   
//方法1,
    //normal = [normal resizableImageWithCapInsets:UIEdgeInsetsMake(h, w, h, w)];//上 左 下 右
   
//方法2,
    normal = [normal stretchableImageWithLeftCapWidth:h topCapHeight:w];//左 上
   
    return normal;
}

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马