• 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: Custom Shaped Buttons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom Shaped Buttons


  • Subject: Re: Custom Shaped Buttons
  • From: Jeff LaMarche <email@hidden>
  • Date: Thu, 20 Mar 2008 09:42:10 -0400

For custom drawing like you want, you will have to override both NSButton and NSButtonCell, and you have to specify the new NSButtonCell class by overriding the cellClass method inyour NSButton's subclass. You'll actually do your drawing in the drawWithFrame: method. It is not a simple process and you'd be better off sticking with the standard buttons if you can, both in terms of amount of work and in terms of conforming to the HIG.

If you google "NSButtonCell subclass" you should find some examples, though I didn't see any that looked exactly like what you want to do.


On Mar 20, 2008, at 8:43 AM, ADIL SALEEM wrote:

Hi,

I need guidance for a problem. I want to make custom
shaped buttons (based on images) in my GUI.

By assigning image and alternate image in IB it
displays the image but the shape of the button is not
exactly as the image. I want to make the button of
exact shape as that of the image.

For that i am trying to subclass NSButton. I have
created the subclass and assigned it to my buttons,
but i have no idea what functions to
implement/overwrite in the subclass to change the
shape of the button and assign the image as the button
shape.


Also please tell me that is this the right way (subclassing NSButton) to do what i am trying to do ?

Thank you



____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
_______________________________________________


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

_______________________________________________

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: 
 >Custom Shaped Buttons (From: ADIL SALEEM <email@hidden>)

  • Prev by Date: [JOB] Junior Software Engineer
  • Next by Date: Re: memcpy strange behavior
  • Previous by thread: Custom Shaped Buttons
  • Next by thread: Re: Custom Shaped Buttons
  • Index(es):
    • Date
    • Thread