• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to fill rectangle under vertical scroller?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to fill rectangle under vertical scroller?


  • Subject: Re: How to fill rectangle under vertical scroller?
  • From: Sumin Kim <email@hidden>
  • Date: Sun, 21 Jun 2009 08:18:48 +0900

>
>
>>
>
> You need to place a view here and do the custom drawing in the view. To
> place the view, you need to subclass NSScrollView and override the -tile
> method to place the view in that corner. The scrollview subclass will also
> typically own the custom view.
>
> Here's an example from the archives that will do what you want:
>
> http://www.cocoabuilder.com/archive/message/cocoa/2001/6/29/21070
>
> --Graham
>
>
>
Hi, Graham,

I think I finally got what you said. I referred your linked sample, and
implemented my source as follows.(I enclose my source for anyone who has
same problem with many thanks to this list.) I also needed to add some code
to drawRect to draw my custom view correctly.

If you find any problem from my source, please let me know.



#import "BSScrollView.h"



@implementation BSScrollView



// Prepare a view to be a background of scrollers. This view will cover all
area of scrollView.

- (void) _setScrollerBackgroundView:(NSView *) view{

[view retain];

[_scrollerBackgroundView release];

_scrollerBackgroundView = view;

[self addSubview:_scrollerBackgroundView];

}

- (NSView *) scrollerBackgroundView {

return _scrollerBackgroundView;

}


- (void)tile {

[super tile];

if (![self scrollerBackgroundView])

{

// Place a view that cover all area of scroll view.

NSRect tempRect = NSMakeRect(0.0, 0.0, [self bounds].size.width, [self
bounds].size.height);

NSView *tempView = [NSView allocWithZone:[self zone]];

[tempView initWithFrame:tempRect];

[self _setScrollerBackgroundView:tempView];

}

}


- (void)drawRect:(NSRect)rect {

[super drawRect:rect];

// draw background color for scroll view. This color fills areas under knob
slots and right bottom area of scroll view.

[[NSColor blackColor]set];

NSRectFill([_scrollerBackgroundView frame]);

}


- (void) dealloc {

[_scrollerBackgroundView release];

[super dealloc];

}

@end
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to fill rectangle under vertical scroller?
      • From: Graham Cox <email@hidden>
References: 
 >How to fill rectangle under vertical scroller? (From: Sumin Kim <email@hidden>)
 >Re: How to fill rectangle under vertical scroller? (From: Graham Cox <email@hidden>)

  • Prev by Date: [WORKAROUND] Re: new NSTreeController bug in 10.5.7?
  • Next by Date: NSDate scope
  • Previous by thread: Re: How to fill rectangle under vertical scroller?
  • Next by thread: Re: How to fill rectangle under vertical scroller?
  • Index(es):
    • Date
    • Thread