I was able to draw a dashed box, using the following code:
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
CGRect shapeRect = CGRectMake(0.0f, 0.0f, 200.0f,
Got it working in Objective C with the simplified code as below
//Dashed line for road
CAShapeLayer *dashedLine = [CAShapeLayer layer];
[dashedLine setFrame:CGRectMake(0, 342, 100 , 100)];
// Setup the path
CGMutablePathRef thePath = CGPathCreateMutable();
CGPathMoveToPoint(thePath, NULL, 0, 10);
CGPathAddLineToPoint(thePath, NULL, screenSize.width,10);
dashedLine.path = thePath;
CGPathRelease(thePath);
[dashedLine setLineDashPattern: [NSArray arrayWithObjects:[NSNumber numberWithFloat:15], nil]];
dashedLine.lineWidth = 1.0f;
dashedLine.strokeColor = [[UIColor redcolor] CGColor]];
[self.view.layer addSublayer:dashedLine];