• 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
defining NSColor constants
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

defining NSColor constants


  • Subject: defining NSColor constants
  • From: Arie Pieter Cammeraat <email@hidden>
  • Date: Thu, 6 Aug 2009 08:58:47 +0200

In my app, I use several colors many times. I'd like to define them in a separate file or class.

Is there another way to do this than:
#define kNiceBlueColor [NSColor colorWithRed: 20 green: 20 blue: 240 alpha:1];


I would like a more obj-c style, like
	globals.h:
		extern NSColor * const kNiceBlueColor

	globals.m:
	#import globals.h

NSColor * const kNiceBlueColor = [NSColor colorWithRed: 20 green: 20 blue: 240 alpha:1];



I found some examples of this kind for defining a NSString using the @"foo"-syntax. With NSColor, it doesn't seem to work. I get the error "initializer element is not constant". Anyone any thoughts on this?

Thanks in advance!


_______________________________________________

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: defining NSColor constants
      • From: Uli Kusterer <email@hidden>
    • Re: defining NSColor constants
      • From: Alastair Houghton <email@hidden>
  • Prev by Date: Re: Core Data completely unable to find the source object model for migration
  • Next by Date: Re: NSMenuItem addTarget & retain
  • Previous by thread: Re: Two right buttons on UINavigationBar?
  • Next by thread: Re: defining NSColor constants
  • Index(es):
    • Date
    • Thread