iOS 图片拉伸
来源:互联网 发布:下载站系统源码 编辑:程序博客网 时间:2024/04/30 23:25
[objc] viewplaincopyprint?
- -
( UIImage*)resizableImageWithCapIns 5_0);ets:(UIEdgeInsets)capInsets NS_AVAILABLE_IOS( // create a resizable version of this image. the interior is tiled when drawn. - -
(UIImage *)resizableImageWithCapIns ets:(UIEdgeInsets)capInsets resizingMode :(UIImageResizingMode)resizingModeNS_AVAILABLE_IOS( 6_0);// the interior is resized according to the resizingMode -
- @property(nonatomic,readonly)
UIEdgeInsets 5_0);capInsets NS_AVAILABLE_IOS( default is UIEdgeInsetsZero for non resizable images - @property(nonatomic,readonly)
UIImageResizingMode 6_0);resizingMode NS_AVAILABLE_IOS( // default is UIImageResizingModeTile
[objc] viewplaincopyprint?
- resizableImageWithCapIns
ets
比如你的图片是120像素的圆角矩形,你想四个角不变,中间随意拉伸。假设每个角都可以用一个10*10的框框框起来。
那你可以使用 (10,10,10,10),在你的图片中画一个(距顶10,距左10,距底10,距右10)的矩形,表示该范围内拉伸。
但是,这个图片的使用就需要注意了,图片要使用1X大小的。
例子:
[objc] viewplaincopyprint?
-
- //
UIImage *image = [UIImage imageNamed:@"image@2x"]; - //
image = [image resizableImageWithCapIns ets:UIEdgeInsetsMake(10.0, 10.0, 10.0, 10.0)]; -
//应使用单倍 -
UIImage *image = [UIImage imageNamed :@"image"]; -
image = [image resizableImageWithCapIns :UIEdgeInsetsMake(10.0,ets 10.0, 10.0, 10.0)];
0 0
- iOS 图片拉伸
- IOS图片拉伸
- iOS图片拉伸
- iOS图片拉伸技巧
- ios图片拉伸
- iOS 图片拉伸
- iOS图片拉伸技巧
- iOS图片拉伸技巧
- IOS图片拉伸技巧
- iOS图片拉伸技巧
- IOS图片拉伸技巧
- ios图片拉伸
- iOS图片拉伸技巧
- iOS图片拉伸技巧
- iOS图片拉伸技巧
- iOS图片拉伸技巧
- iOS图片拉伸技巧
- IOS 拉伸图片
- NSUserDefaults简介及使用
- 详说CMDeviceMotion
- hdmi芯片有transmitter和receiver之分
- iOS8下的开发变化
- 惹恼程序员的十件事
- iOS 图片拉伸
- 使用grep搜索文件内容——快捷、方便
- UITextField详解
- 图像压缩成指定大小(高度/宽度)
- iOS视频拍摄与压缩
- DataTable
- 线性代数·矩阵的加法减法乘法运算简单实现
- AFNetworking详细说明
- SDWebImage使用