星空网 > 软件开发 > 操作系统

ios图片拉伸两种方法

 UIImage *image = [UIImage imageNamed:@"qq"];

第一种:

 // 左端盖宽度  NSInteger leftCapWidth = image.size.width * 0.5f;  // 顶端盖高度  NSInteger topCapHeight = image.size.height * 0.5f;  // 重新赋值  image = [image stretchableImageWithLeftCapWidth:leftCapWidth topCapHeight:topCapHeight];

ios图片拉伸两种方法

第二种:

  CGFloat top = 25; // 顶端盖高度  CGFloat bottom = 25 ; // 底端盖高度  CGFloat left = 10; // 左端盖宽度  CGFloat right = 10; // 右端盖宽度  UIEdgeInsets insets = UIEdgeInsetsMake(top, left, bottom, right);  // 指定为拉伸模式,伸缩后重新赋值  image = [image resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch];

ios图片拉伸两种方法




原标题:ios图片拉伸两种方法

关键词:IOS

IOS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流