IOSButton自定义
+ (APCCustomBackButton *)customBackButtonWithTarget:(id)aTarget action:(SEL)anAction tintColor:(UIColor *)aTintColor
{
APCCustomBackButton *button = [APCCustomBackButton buttonWithType:UIButtonTypeCustom];
CGRect frame = CGRectMake(0.0, 0.0, kButtonWidth, kButtonHeight);
button.frame = frame;
[button addTarget:aTarget action:anAction forControlEvents:UIControlEventTouchUpInside];
CGMutablePathRef path = CGPathCreateMutable();
CGPoint p0 = CGPointMake(13.0, 12.0);
CGPathMoveToPoint(path, NULL, p0.x, p0.y);
CGPoint p1 = CGPointMake(2.0, 22.0);
CGPathAddLineToPoint(path, NULL, p1.x, p1.y);
CGPoint p2 = CGPointMake(13.0, 32.0);
CGPathAddLineToPoint(path, NULL, p2.x, p2.y);
CALayer *layer = button.layer;
CAShapeLayer *shaper = [[CAShapeLayer alloc] init];
shaper.frame = CGRectMake(0.0, 0.0, kLayerWidth, kLayerHeight);
shaper.bounds = CGRectMake(0.0, 0.0, kLayerWidth, kLayerHeight);
shaper.path = path;
shaper.lineWidth = kArrowLineWeight;
shaper.fillColor = [[UIColor clearColor] CGColor];
shaper.contentsScale = [[UIScreen mainScreen] scale];
shaper.strokeColor = aTintColor.CGColor;
[layer addSublayer:shaper];
CGPathRelease(path);
return button;
}
最新文章
- Java之工厂方法
- struts2使用Convention Plugin在weblogic上以war包部署时,找不到Action的解决办法
- ACM/ICPC 之 Kruskal范例(ZOJ1203-POJ1861(ZOJ1542))
- Atitit.为什么小公司也要做高大上开源项目
- uva133-S.B.S.
- 【Reporting Services 报表开发】— 矩阵的使用
- DataGridView显示行号的几种方法来自http://www.soaspx.com/dotnet/csharp/csharp_20100204_2740.html
- Asp.Net 之 调用分享接口
- Config
- (?m)使用实例
- Android拖动和缩放图片
- web 直播&;即时聊天------阿里云、融云(三)
- Entity framework 中Where、First、Count等查询函数使用时要注意
- 《15个提高Google搜索的技巧》
- MongoDB下,启动服务时,出现“服务没有响应控制功能”解决方法
- 让终端走socks5代理
- 爬虫——request
- javamail邮件Multipart支持同时发text和html混合消息,alternative纯文本与超文本共存
- Mac svn使用学习-2-服务端
- Online Judge 2014 K-th Number -主席树