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 alway开发者_JAVA百科s seems to be transparent. Is there a better method to use to draw an empty rectangle?
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.
精彩评论