• 画虚线的方法 (记录)


    +(UIImage *)lineWithImageView:(UIImageView *)imageView{

        CGFloat width = imageView.frame.size.width;

        CGFloat height = imageView.frame.size.height;

        UIGraphicsBeginImageContext(imageView.frame.size);

        [imageView.image drawInRect:CGRectMake(0, 0, width, height)];

        CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);

        CGFloat lengths[] = {5,2};

        CGContextRef line = UIGraphicsGetCurrentContext();

        CGContextSetStrokeColorWithColor(line, [UIColor colorWithRed:128/255.0 green:128/255.0 blue:128/255.0 alpha:0.6].CGColor);

        CGContextSetLineDash(line, 0, lengths, 1);

        CGContextMoveToPoint(line, 0, 1);

        CGContextAddLineToPoint(line, width-10, 1);

        CGContextStrokePath(line);

        return  UIGraphicsGetImageFromCurrentImageContext();

    }

  • 相关阅读:
    递归分治策略
    矩阵连乘问题
    棋盘覆盖问题
    选择排序
    Dijkstra的双栈算术表达式求值算法
    斐波那契数列
    二分算法
    Linux服务器上tengine的安装配置
    Excel Sheet Column Number
    Excel Sheet Column Title
  • 原文地址:https://www.cnblogs.com/wj0920wjx/p/8807262.html
Copyright © 2020-2023  润新知