zoukankan      html  css  js  c++  java
  • 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;

    }

  • 相关阅读:
    图解 SQL 各种连接查询之间的区别
    虚拟机Ubuntu无法上网问题解决过程
    SQL语言(二) java怎样连接操作数据库中的数据
    SQL语言(一)
    编写简单的用户登录界面
    Java
    java第一阶段测试
    Net Core linux docker 部署异常
    .Net Core Cap 异常
    记.Net 创建文件
  • 原文地址:https://www.cnblogs.com/wcLT/p/4743794.html
Copyright © 2011-2022 走看看