定制属于你自己的阴影效果
来源:互联网 发布:uda sql 0432 编辑:程序博客网 时间:2024/04/28 14:09
- #import <QuartzCore/QuartzCore.h>
- @implementation UIView (NKShadow)
- // add the shadow effect to the view
- -(void)addShadow{
- self.layer.shadowOpacity = 0.4;
- self.layer.shadowRadius = 0.9;
- self.layer.shadowOffset = CGSizeMake(0, 0);
- UIBezierPath *path = [UIBezierPath bezierPath];
- CGPoint p1 = CGPointMake(self.frame.origin.x, self.frame.origin.y+self.frame.size.height);
- CGPoint p2 = CGPointMake(self.frame.origin.x+self.frame.size.width, p1.y);
- CGPoint c1 = CGPointMake((p1.x+p2.x)/4 , p1.y+6.0);
- CGPoint c2 = CGPointMake(c1.x*3, c1.y);
- [path moveToPoint:p1];
- [path addCurveToPoint:p2 controlPoint1:c1 controlPoint2:c2];
- self.layer.shadowPath = path.CGPath;
- }
- -(void)addGrayGradientShadow{
- // 0.8 is a good feeling shadowOpacity
- self.layer.shadowOpacity = 0.4;
- // The Width and the Height of the shadow rect
- CGFloat rectWidth = 10.0;
- CGFloat rectHeight = self.frame.size.height;
- // Creat the path of the shadow
- CGMutablePathRef shadowPath = CGPathCreateMutable();
- // Move to the (0, 0) point
- CGPathMoveToPoint(shadowPath, NULL, 0.0, 0.0);
- // Add the Left and right rect
- CGPathAddRect(shadowPath, NULL, CGRectMake(0.0-rectWidth, 0.0, rectWidth, rectHeight));
- CGPathAddRect(shadowPath, NULL, CGRectMake(self.frame.size.width, 0.0, rectWidth, rectHeight));
- self.layer.shadowPath = shadowPath;
- CGPathRelease(shadowPath);
- // Since the default color of the shadow is black, we do not need to set it now
- //self.layer.shadowColor = [UIColor blackColor].CGColor;
- self.layer.shadowOffset = CGSizeMake(0, 0);
- // This is very important, the shadowRadius decides the feel of the shadow
- self.layer.shadowRadius = 10.0;
- }
- @end
0 0
- 定制属于你自己的阴影效果
- 定制属于你自己的阴影效果
- Android定制属于你自己的导航栏
- Android定制属于你自己的导航栏
- Android定制属于你自己的导航栏
- Android定制属于你自己的导航栏
- Android定制属于你自己的导航栏
- ASP.NET MVC - 定制属于你自己的ViewEngine
- ASP.NET MVC - 定制属于你自己的ViewEngine
- 利用rpmbuild打包定制属于你自己的RPM包
- ASP.NET MVC - 定制属于你自己的ViewEngine
- 数据绑定DBinder完全解析。轻松定制属于你自己的绑定框架。
- 打造属于你自己的BaseAdapter
- 如何定制你自己的DataGrid
- 定制你自己的桌面--- launcher
- 如何定制你自己的jQuery
- 定制你自己的CRF模型
- 用PHPdig打造属于你自己的Google
- iOS不用版本获取UDID的方法
- 记忆减退之----ili9320 液晶 标准37P
- 《UNIX环境高级编程》——UNIX标准及实现
- 关于stack around the variable “” was corrupted问题
- Mapping Properties to String Keys
- 定制属于你自己的阴影效果
- [Liferay] Liferay 实现单点登录 - CAS
- 解决部分升级Xcode6定位、键盘、推送问题
- 第10周上机实践项目2——M$pszi$y是嘛意思?
- POJ 3211 Washing Clothes(01背包)
- [android] Serializable 和 Parcelable 区别
- robotium常用的一些函数
- netbeans配置xdebug
- Repeater 鼠标指向一行的时候行变,鼠标离开颜色复位。