Re: Adding Graphics to Buttons
Re: Adding Graphics to Buttons
- Subject: Re: Adding Graphics to Buttons
- From: Herr Witten <email@hidden>
- Date: Sun, 1 Feb 2004 01:11:23 -0500
If it is a button, you can use setImage: However, I think there is
difficulty when you deal with a popup button or the like. In that
situation, I think you can simply set the image for a menu item or for
the first menu item, or you could simply subclass the button and treat
it as a view, implementing your own drawRect: method:
- (void)drawRect: (NSRect)rect
{
NSRect imageRect = NSMakeRect(0, 0, 0, 0);
imageRect.size = [_image size];
NSSize frameSize = [self frame].size;
[_image drawAtPoint: NSMakePoint(frameSize.width / 2, framSize.height
/ 2)
fromRect:imageRect operation: NSCompositeCopy fraction: 1.0];
}
On 1 Feb 2004, at 12:08 AM, 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.
_______________________________________________
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.