• 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: Adding Graphics to Buttons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding Graphics to Buttons


  • Subject: Re: Adding Graphics to Buttons
  • From: Fritz Anderson <email@hidden>
  • Date: Sun, 1 Feb 2004 00:35:19 -0600

On 31 Jan 2004, at 11:08 PM, Tom Gray wrote:
I would like to add a simple graphic arrow pointing to the left or to the right to a button. Can anyone point me at some sample code of using a graphic with a button.

If it suffices to just show an arrow, have you considered setting the title of the button to a Unicode arrow character? Use the Jaguar-or-later Character Palette in its Unicode Table mode to look up the character code, and either use the palette to set the title directly in Interface Builder, or programatically with something like

unichar leftArrow = 0x2190;
[theButton setTitle: [NSString stringWithCharacters: &leftArrow length: 1]];

Also useful for these purposes are the left-, right-, up-, and down-facing triangles to be found around the 25B0's. The arrows are a bit too spindly to use in buttons, for my eye.

Otherwise, you have to produce an image of an arrow, of the desired size, with your favorite graphics program, and include the image file in the resources of your application (add it to the Resources group in Xcode or Project Builder). Then tell IB to display the image in the button. (Or, programatically, load the file into an NSImage and use NSButton's setImage: and setImagePosition:.)

-- F
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Adding Graphics to Buttons (From: Tom Gray <email@hidden>)

  • Prev by Date: Does NSImageView dispose of it's image
  • Next by Date: Re: Adding Graphics to Buttons
  • Previous by thread: Re: Adding Graphics to Buttons
  • Next by thread: Re: Adding Graphics to Buttons
  • Index(es):
    • Date
    • Thread