Try wrapping the call to super like this:

[NSGraphicsContext saveGraphicsState];
[super drawRect:rect];
[NSGraphicsContext restoreGraphicsState];

        
On May 8, 2011, at 6:27 AM, Дмитрий Николаев wrote:

> Code in Custom NSTextView - (void) drawRect:
> 
> ----------
> [super drawRect:dirtyRect];
> 
> NSBezierPath* aPath = [NSBezierPath bezierPath];
> [aPath moveToPoint:NSMakePoint(100, 100)];
> [aPath lineToPoint:NSMakePoint(500, 100)];
> [aPath stroke];
> -----------
> 
> Custom textview resize policy set, so it resizes in all dimensions with 
> container. This is code for custom NSTextView
> 
> ---------
> - (void) setFrameSize:(NSSize)newSize {
> 
>   [super setFrameSize:newSize];
> 
>   NSTextContainer *container = [self textContainer];
>   newSize.width -= 200;
>   [container setContainerSize:newSize];
> }
> ------------
> 
> 08.05.2011, в 5:53, Ross Carter написал(а):
> 
>> We need to see your code. In general, any drawing code after the call to 
>> super in the textView's drawRect method will draw. But maybe you are trying 
>> to do something different.
>> 
>> 
>> On May 7, 2011, at 3:13 AM, Дмитрий Николаев wrote:
>> 
>>> But when i try draw a line in NSTextView, it limited to frame of text 
>>> container too.
>>> 
>>> 06.05.2011, в 22:56, Ross Carter написал(а):
>>> 
>>>> On May 6, 2011, at 2:40 AM, Дмитрий Николаев wrote:
>>>> 
>>>>> If there are any possibility to draw inside text view but outside of text 
>>>>> container ?
>>>> 
>>>> It depends on who is doing the drawing. NSTextView is an NSView subclass 
>>>> and you can override drawRect: just like any NSView. The Cocoa text 
>>>> system, however, draws inside the area specified by a NSTextContainer.
>>> 
>>> 
>> 
> 

_______________________________________________

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

Reply via email to