• 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: Customize NSScroller
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Customize NSScroller


  • Subject: Re: Customize NSScroller
  • From: "Mr. Gecko" <email@hidden>
  • Date: Sat, 4 Oct 2008 10:38:06 -0500

Never mind I found out how
- (void)drawKnob {
NSRect position = [self rectForPart:NSScrollerKnob];
NSImage *topImg = [NSImage imageNamed:@"kt"];
[topImg setFlipped:YES];
NSSize topImgSize = [topImg size];
[topImg drawInRect:NSMakeRect(position.origin.x, position.origin.y, topImgSize.width, topImgSize.height)
fromRect:NSMakeRect(0, 0, topImgSize.width, topImgSize.height)
operation:NSCompositeSourceOver
fraction:1.0];

NSImage *centerImg = [NSImage imageNamed:@"kc"];
NSSize centerImgSize = [centerImg size];
int i = 0;
for (i = (position.origin.y+12); i < (position.origin.y + (position.size.height-12)); i += centerImgSize.height) {
[centerImg drawInRect:NSMakeRect(position.origin.x, i, position.size.width, centerImgSize.height)
fromRect:NSMakeRect(0, 0, centerImgSize.width, centerImgSize.height)
operation:NSCompositeSourceOver
fraction:1.0];
}

NSImage *bottomImg = [NSImage imageNamed:@"kb"];
[bottomImg setFlipped:YES];
NSSize bottomImgSize = [bottomImg size];
[bottomImg drawInRect:NSMakeRect(position.origin.x, position.origin.y+ (position.size.height-12), bottomImgSize.width, bottomImgSize.height)
fromRect:NSMakeRect(0, 0, bottomImgSize.width, bottomImgSize.height)
operation:NSCompositeSourceOver
fraction:1.0];
}
On Oct 4, 2008, at 3:08 AM, Mr. Gecko wrote:


Hello I have been working on making a custom NSScroller and so far I got a lot done. the only thing I am having trouble with is drawing the knob.
I have three images top, center, and bottom. how can i put that together to make a scroll bar.
Top and Bottom width is 15 and height is 12.
Center width is 15 and height is 1.


Thanks,
Mr. Gecko

_______________________________________________

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


References: 
 >Customize NSScroller (From: "Mr. Gecko" <email@hidden>)

  • Prev by Date: Re: Clueless about this warning
  • Next by Date: UINavigationItem backButtonTitle property is missing?
  • Previous by thread: Customize NSScroller
  • Next by thread: Accessing IB >Inspector > Identity > Interface Builder Identity > name programatically?
  • Index(es):
    • Date
    • Thread