IOS开发教程--如何使用点9图片
事先準備一張圖片:
UIImage *image = [UIImage imageNamed:@"red.png"];
?? ?在iOS 5.0之前可以這么用:
? ? NSInteger leftCapWidth = image.size.width * 0.5f;
? ? NSInteger topCapHeight = image.size.height * 0.5f;
? ? image = [image stretchableImageWithLeftCapWidth:leftCapWidth topCapHeight:topCapHeight];
在iOS 5.0中可以這么用:
? ? CGFloat top = 8;// 頂端蓋高度
? ?CGFloat bottom = 8; // 底端蓋高度
? ? CGFloat left = 8; // 左端蓋寬度
? ?CGFloat right = 8;// 右端蓋寬度
? ? UIEdgeInsets insets = UIEdgeInsetsMake(top, left, bottom, right);
? ? // 伸縮后重新賦值
? ? image = [image resizableImageWithCapInsets:insets];
在iOS6.0中可以這么用:
? ?CGFloat top = 12; // 頂端蓋高度
? ? CGFloat bottom = 12 ; // 底端蓋高度
? ? CGFloat left = 10; // 左端蓋寬度
? ? CGFloat right = 10; // 右端蓋寬度
? ? UIEdgeInsets insets = UIEdgeInsetsMake(top, left, bottom, right);
? ? // 指定為拉伸模式,伸縮后重新賦值
? ? image = [image resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch];
總結
以上是生活随笔為你收集整理的IOS开发教程--如何使用点9图片的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: import scipy.io as s
- 下一篇: k8s 1.23 及keda 2.7.1