On Nov 30, 2014, at 9:30 AM, Navneet Kumar <navnee...@me.com> wrote:
> 
> Hi,
> 
> I have a custom view in which I am setting the background using NSRectFill() 
> in drawRect:.

You’re aware that this function is only really suitable for drawing opaque 
colors, yes? If you NSRectFill() with a transparent color, it will not blend 
that color with the existing backing store. Instead, it will replace all pixels 
in that rect with transparent ones, obliterating any drawing performed by 
ancestor views in the hierarchy.

> I am also adding a text field as subview in this method.

This is not allowed. -drawRect: is for drawing, not mutating your view 
hierarchy.

If you want to position/install views at the last possible second before the 
drawing pass, use -viewWillDraw. But you have not offered any reasons why you 
need to dynamically add or remove views at all, much less in tandem with the 
drawing pass.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to