- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCap
来源:互联网 发布:jira linux 安装手册 编辑:程序博客网 时间:2024/05/21 11:27
原文链接 http://www.cnblogs.com/dark-angel/archive/2011/06/16/2082940.html
先引用一段: http://www.cnblogs.com/haipingwu/
- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight这个函数是UIImage的一个实例函数,它的功能是创建一个内容可拉伸,而边角不拉伸的图片,需要两个参数,第一个是不拉伸区域和左边框的宽度,第二个参数是不拉伸区域和上边框的宽度。
第一次用这个函数的时候一直搞不懂为什么只要两个参数就行,至少应该指定左上角和右下角,总共四个参数啊。后来读读文档才明白,只需要两个参数就行了。
参数的意义是,如果参数指定10,5。那么,图片左边10个像素,上边5个像素。不会被拉伸,x坐标为11和一个像素会被横向复制,y坐标为6的一个像素会被纵向复制。注意:只是对一个像素进行复制到一定宽度。
附:两个聊天用的汽泡,与参数值。
21,13。
15,13。
再看看实例,代码如下:
UIImage* image =[UIImage imageNamed:@
"image.png"
];
UIImageView* imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 400)];
[imageView setImage:[image stretchableImageWithLeftCapWidth:40 topCapHeight:40]];
[
self
.view addSubview:imageView];
[imageView release]; <br>
最后看看结果,不解释:
原图:
结果图:
结束,不解释
- - (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCap
- - (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCap
- - (UIIMAGE *)STRETCHABLEIMAGEWITHLEFTCAPWIDTH:(NSINTEGER)LEFTCAPWIDTH TOPCAPHEIGHT:(NSINTEGER)TOPCAP
- - (UIImage*)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapH
- stretchableImageWithLeftCapWidth:leftCapWidth topCapHeight:
- IOS图片拉伸的方法 UIImage stretchableImageWithLeftCapWidth:leftCapWidth:topCapHeight
- 关于- (UIImage *)stretchableImageWithLeftCapWidth: topCapHeight:
- stretchableImageWithLeftCapWidth:topCapHeight:函数用法 总结 (UIImage)
- NSInteger问题
- NSInteger问题
- stretchableImageWithLeftCapWidth:topCapHeight:函数用法
- stretchableImageWithLeftCapWidth:topCapHeight:函数用法
- stretchableImageWithLeftCapWidth:topCapHeight:函数用法
- stretchableImageWithLeftCapWidth:topCapHeight:函数用法
- stretchableImageWithLeftCapWidth:topCapHeight:函数用法
- stretchableImageWithLeftCapWidth:topCapHeight:使用
- stretchableImageWithLeftCapWidth:topCapHeight:函数用法 总结
- iOS图像拉伸,stretchableImageWithLeftCapWidth:topCapHeight:
- shell_read读取标准输入
- HashSet学习笔记(一)
- android fragment切换无法保存状态的一种解决方法
- AccessControlException: Non-super user cannot change owner
- 第9周体验项目:输入星期值,输出英文【多分支】
- - (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCap
- 第7周项目4--星号图(d)
- Android:EditText 多行显示及所有属性
- libguestfs 1.24 发布,虚拟机磁盘映像文件API
- NET命令
- 示例:使用 Rafy 领域实体框架转换传统三层应用程序
- CPUFREQ 参数解释
- 向一个资源的URI发送GET、POST、PUT和DELETE进行获取、创建、保存、删除操作
- 如何增加tomcat的使用内存