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?

Answers


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.


Need Your Help

How to implement dynamic binary search for search and insert operations of n element

c algorithm arrays binary-search

The idea is to use multiple arrays, each of length 2^k, to store n elements, according to binary representation of n.Each array is sorted and different arrays are not ordered in any way.

Find deep children in MongoDB

mongodb pymongo mongodb-query

I've searched the docs and web throughly but cannot find any solution for this seemingly trivial problem. Let's say we have a collection called "states". The states collection has a document that l...