Questions tagged [drawrect]

Method in UIView/NSView class. Draws the receiver’s image within the passed-in rectangle.

Signature

- (void)drawRect:(CGRect)rect

rect - The portion of the view’s bounds that needs to be updated. The first time your view is drawn, this rectangle is typically the entire visible bounds of your view. However, during subsequent drawing operations, the rectangle may specify only part of your view.

The default implementation of this method does nothing. Subclasses that use native drawing technologies (such as Core Graphics and UIKit) to draw their view’s content should override this method and implement their drawing code there.

1051 questions
-4
votes
1 answer

How to deal with drawRect in cocoa?

I have to draw lines few times. I do this now: - (void)drawRect:(NSRect)dirtyRect { [NSGraphicsContext saveGraphicsState]; NSBezierPath *path = [NSBezierPath bezierPath]; [path moveToPoint:point]; [[NSColor…
Tomasz Szulc
  • 4,217
  • 4
  • 43
  • 79
1 2 3
70
71