Mike2012
Mike2012

Reputation: 7725

Does strokeRect: of NSBezierPath always draw a transparent rect? (Cocoa OSX)

I am trying to make a custom selection box for an image view I created and I am trying to use strokeRect: from NSBezierPath but it always seems to be transparent. Called the method set to set the color the blackColor and then also tried using olorWithDeviceRed:green:blue:alpha: but no matter what I have tried the rectangle created always seems to be transparent. Is there a better method to use to draw an empty rectangle?

Upvotes: 1

Views: 979

Answers (1)

Ashley Clark
Ashley Clark

Reputation: 8823

Are you seeing the boundaries of your strokeRect:?

All +strokeRect: does is draw the outside edge defined by the rect. If you want to fill that rect as well you would need to call [NSBezierPath fillRect:rect]. In this case it will use the current fill color. Calling -set on a color sets the stroke and fill color but if you want to set it individually you'd call -setFill on your color object.

Upvotes: 1

Related Questions