Solution: Want to draw an eclipse with layer width but if i change the layerwidth object must be inside the rect.So used the below code to achieve that. CGContextRef ctx = UIGraphicsGetCurrentContext (); CGContextClearRect (ctx, rect); CGContextSetLineWidth (ctx, self . Width ); CGRect shapeRect; shapeRect = CGRectMake ( 0 , 0 , self . bounds . size . width , self . bounds . size . height ); CGContextClearRect (ctx, rect); CGContextSetLineWidth (ctx, self . Width ); CGPathRef path = CGPathCreateWithRect ( shapeRect, NULL ); CGContextRef context = UIGraphicsGetCurrentContext (); // not needed, but if you're doing other drawing, it'll be needed. shapeRect = CGRectMake (shapeRect. origin . x + Width , shapeRect. origin . y + Width , shapeRect. size . width -( Wid th * 2 ), shapeRect. size . height -( Wi dth * 2 )); CGContextSetStrokeColorWithCol or (ctx, color. CGColor ); [[ UIColor clearColor ] setFill ];