To get dashed line:
CGContextRef context = UIGraphicsGetCurrentContext();
float dash[2]={6 ,5}; // pattern 6 times “solid”, 5 times “empty”
CGContextSetLineDash(context,0,dash,2);
To get back to solid line:
float normal[1]={1};
CGContextSetLineDash(context,0,normal,0);