On 30 Dec 2010, at 22:22, colo wrote: > I was following the Chapter 17 Cocoa programming for osx 3rd ed > The code is below. > All I want to do for a working example is draw an NSView subview in > the superview. > And give it have a color and width height. > > I was trying all sorts of things. I can draw NSMakeRects in the drawRect > method > But I just can't get it to draw another NSview for practice. > Or draw an NSMakeRect as a NSView.
You don't "draw" an NSView. An NSView (or subclass) is either a subview of your view, or it isn't. And you mustn't add or remove subviews during your -drawRect: method; during drawing, the set of subviews really needs to remain stable in order for Cocoa's optimised drawing machinery to function correctly. Kind regards, Alastair. -- http://alastairs-place.net _______________________________________________ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com