UISwitch *noticeSwtich = [[UISwitch alloc] initWithFrame:CGRectMake(0, 0, 51, 31)];// noticeSwtich.layer.cornerRadius = noticeSwtich.he...
分类:
其他好文 时间:
2015-01-22 21:40:38
阅读次数:
141
通过代码,至少有三种方法可以为视图加上圆角效果。附例子:https://github.com/weipin/RoundedCorner方法一、layer.cornerRadius第一种方法最简单,通过层对象的cornerRadius属性实现圆角效果,代码如下:view.layer.cornerRad...
分类:
移动开发 时间:
2014-12-26 16:24:11
阅读次数:
148
图片框圆角处理(UIImageView):添加QuartzCore.framework导入库头文件#import “QuartzCore/QuartzCore.h”//圆角设置imageView.layer.cornerRadius = 8;(值越大,角就越圆)imageView.layer.mas...
分类:
移动开发 时间:
2014-12-23 17:17:16
阅读次数:
208
* 当你发现使用cornerRadius不管用时,试试`view.layer.masksToBounds = YES;`,[Read more.](http://stackoverflow.com/a/22348469/1388881) * 不像在Android下,iOS里面想搞个点击除了button方便点,其他View着...
分类:
移动开发 时间:
2014-11-26 11:43:04
阅读次数:
208
我们在做iOS开发的时候,往往需要实现不规则形状的头像,如:
那如何去实现?
通常图片都是矩形的,如果想在客户端去实现不规则的头像,需要自己去实现。
1.使用layer去实现, imageView.layer.cornerRadius = 10;
2.使用CAShapeLayer, CALayer如何去实现
我们来看看如何使用CAShapeLayer去实现,
定义一个Shape...
分类:
移动开发 时间:
2014-11-16 20:10:27
阅读次数:
222
- (UIImage *)roundedCornerImageWithCornerRadius:(CGFloat)cornerRadius { CGFloat w = self.size.width; CGFloat h = self.size.height; CGFloat scale = ...
分类:
其他好文 时间:
2014-11-10 13:45:12
阅读次数:
166
push是定义的一个button push.layer.masksToBounds = YES; push.layer.cornerRadius = 100; push.layer.borderWidth = 10; push.layer.borderColor = [[UIColor b...
分类:
移动开发 时间:
2014-11-05 14:28:12
阅读次数:
157
在程序对应坐置插入以下代码,或是先拖一个按钮控件到窗体中,再替换对应的代码。修改CornerRadius="18,3,18,3" 就可以改变圆角大小按钮效果: ...
分类:
其他好文 时间:
2014-09-27 21:06:40
阅读次数:
255
很多人都有把按钮做成圆角的需求,以前我们会在代码中加入如下代码实现这个功能:mainImgView.layer.cornerRadius = 6;现在Xcode6加了 RunTime Attributes 的特性之后,我们可以直接在Xcode中设置:这样运行之后就会显示圆角的效果了:...
分类:
移动开发 时间:
2014-09-27 20:41:10
阅读次数:
176
UIView负责交互和frame以及显示CALayerCALayer负责渲染,是UIView的一个readonly属性用来设置圆角参数是内切圆的半径,如果想画一个圆的话,view必须是正方形.参数应该是view边长的一半self.changeView.layer.cornerRadius=50;描边的宽度self.changeView.layer.borderWidth=5;描边..
分类:
其他好文 时间:
2014-09-18 03:17:53
阅读次数:
166