论坛首页 移动开发技术论坛

添加阴影和设置圆角

浏览 5186 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2011-07-07  
iOS
圆角:

	CALayer * layer = [theView layer];
	
	[layer setMasksToBounds:YES];
	[layer setCornerRadius:theRadius];
	[layer setBorderWidth:theBorderWidth];
	[layer setBorderColor:theColor.CGColor];


其中:theView(UIView)为目标view
theRadius(float)为圆角半径
theBorderWidth(float)为边框大小
theColor(UIColor)为边框颜色

---------------------------我割---------------------------

阴影:

	CALayer * layer = [theView layer];
	
	[layer setShadowOffset:theOffset];
	[layer setShadowRadius:theRadius];
	[layer setShadowOpacity:theOpacity];
	[layer setShadowColor:theColor.CGColor];


其中:theView(UIView)为目标view
theOffset(CGSize)为阴影偏移量,默认为(0, -3)
theRadius(float)为阴影四角圆角半径,默认值为3
theOpacity(float)为阴影透明度(取值为[0,1])
theColor(UIColor)为阴影颜色
   发表时间:2011-08-09  
割掉你的!
0 请登录后投票
论坛首页 移动开发技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics