stretchableImageWithLeftCapWidth ios支持.9
来源:互联网 发布:周杰伦唱功 知乎 编辑:程序博客网 时间:2024/06/05 18:06
- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:
(NSInteger)topCapHeight 这个函数是UIImage的一个实例函数,它的功能是创建一个内容可拉伸,而边角不拉伸的图片,需要两个参数,第一个是左边不拉伸区域的宽度,第二个参数是上面不拉伸的高度。
根据设置的宽度和高度,将接下来的一个像素进行左右扩展和上下拉伸。
注意:可拉伸的范围都是距离leftCapWidth后的1竖排像素,和距离topCapHeight后的1横排像素。
参数的意义是,如果参数指定10,5。那么,图片左边10个像素,上边5个像素。不会被拉伸,x坐标为11和一个像素会被横向复制,y坐标为6的一个像素会被纵向复制。
注意:只是对一个像素进行复制到一定宽度。而图像后面的剩余像素也不会被拉伸。
UIImage *img=[UIImage imageNamed:@"bubbleSelf.png"];
img=[img stretchableImageWithLeftCapWidth:15 topCapHeight:12];
UIImageView *imgView=[[UIImageView alloc]initWithImage:img];
[imgView setFrame:CGRectMake(10, 10, 200, 200)];
[self. view addSubview:imgView];
一开始羡慕android拉伸有9妹,找了找文档发现iOS拉伸更方便。
- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight;
使用方法:
imageView.image= [[UIImageimageNamed:@"image"]stretchableImageWithLeftCapWidth:15topCapHeight:15];
0 0
- stretchableImageWithLeftCapWidth ios支持.9
- stretchableImageWithLeftCapWidth ios支持.9
- stretchableImageWithLeftCapWidth ios支持.9
- IOS stretchableImageWithLeftCapWidth
- iOS图像拉伸,stretchableImageWithLeftCapWidth
- iOS image----- stretchableImageWithLeftCapWidth
- iOS图像拉伸,stretchableImageWithLeftCapWidth
- iOS 图像拉伸,stretchableImageWithLeftCapWidth
- iOS图像拉伸,stretchableImageWithLeftCapWidth
- iOS图像拉伸,stretchableImageWithLeftCapWidth:topCapHeight:
- stretchableImageWithLeftCapWidth
- stretchableImageWithLeftCapWidth
- stretchableImageWithLeftCapWidth
- stretchableImageWithLeftCapWidth
- stretchableImageWithLeftCapWidth
- stretchableImageWithLeftCapWidth
- stretchableImageWithLeftCapWidth
- stretchableImageWithLeftCapWidth
- Shell SCP/上传文件
- 装linux 系统后 基本的设置(ubuntu)
- Struts中使用ajax
- HDU1907 John 【博弈】
- 协方差与协方差矩阵
- stretchableImageWithLeftCapWidth ios支持.9
- java异步发送邮件
- Extending Python with C\C++ 实践问题
- 分布式服务框架远程服务通讯简单实现
- tomcat配置cgi
- android学习之(1)----开发环境搭建
- 角点检测和匹配之Harris与FAST角点检测
- 【tcp-ip学习笔记】关于IP协议层、IP地址
- WPF圆角透明无边框窗体