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

Re: drawAtPoint?


  • Subject: Re: drawAtPoint?
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Wed, 9 Mar 2005 07:13:52 +0100

At 19:26 Uhr -0800 08.03.2005, Mark Dawson wrote:
NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init];
[attributes setObject:[NSFont fontWithName:@"Times" size:18] forKey:NSFontAttributeName];

Shorter:

	NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:
					[NSFont fontWithName:@"Times" size:18],
					NSFontAttributeName,
					nil ];

[[[NSString alloc] initWithString: @"TEST"] drawAtPoint:NSMakePoint(0, imageBounds.size.height/2), withAttributes:attributes];

You have a stray comma here after the closing bracket.

Oh, and you can just use

	[@"TEST" drawAtPoint: NSMakePoint(0, imageBounds.size.height/2)
			withAttributes:attributes];

A string constant is a full-blown object in Objective C and you can send it messages directly.

--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
       "The Witnesses of TeachText are everywhere..."
                   http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >drawAtPoint? (From: Mark Dawson <email@hidden>)

  • Prev by Date: Re: messaging between (un)related objects
  • Next by Date: Re: SystemStatusBar question
  • Previous by thread: Re: drawAtPoint?
  • Next by thread: Detect URL in NSTextView
  • Index(es):
    • Date
    • Thread