iOS: CoreGraphics Drawing -failing to draw a rectangle border
iOS: CoreGraphics Drawing -failing to draw a rectangle border
- Subject: iOS: CoreGraphics Drawing -failing to draw a rectangle border
- From: Development <email@hidden>
- Date: Tue, 14 Jun 2011 10:06:35 -0700
I am attempting to draw a marque around a rectangle when the user touches it.
Now if I use the following code around an ellipse it works perfectly.
But let me explain how this is set up.
There is an outer view and then a second inner view of the exact same size. The inner view is where I actually draw the rectangle or ellipse. (this was done to solve issues with transforms that were making a huge mess of the shapes if I rotated them)
When a user touches the view however it is selected and draws a set of handles for resizing and it should draw a moving marque around the border of the outer view.
The handles work.
if it's an ellipse it all works.
but if the shape is a simple rectangle it blows up in my face. Basically I get the handles. and they function as designed. BUT no matter what I do I cannot get the darn marque to draw at all. Now understand that it draws every .5 seconds. it is a dashed line and every .5 seconds it shifts from white to black or vise versa. it also moves forward about 3 pixels to create an illusion of movement. And again it looks great when the shape being drawn is an ellipse.
I have gone through the code and made absolutely sure that no where in the outer view is there anywhere that the border color or width are set using .layer.borderColor = or .layer.borderWidth
thus as I understand the following code should be producing the correct effect:
CGContextSetLineWidth( context, 3.0 );
CGContextSetStrokeColorWithColor(context, mColor.CGColor);
CGContextClearRect(context, rect);
float dashPhase = cPhase;
float dashLengths[] = { 6, 6};
CGContextSetLineDash( context,
dashPhase, dashLengths,
sizeof( dashLengths ) / sizeof( float ) );
CGContextStrokeRect(context, rect);
I have even tried removing any and all border color and width changes made in the inner most rect but again no change I just plain get nothing. I should at the very least see a blinking white dashed line on a dark background or a blinking black line on a white background._______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden