• 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
attributedTitle method of NSMenuItem returns no attributes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

attributedTitle method of NSMenuItem returns no attributes


  • Subject: attributedTitle method of NSMenuItem returns no attributes
  • From: Gezim Hoxha <email@hidden>
  • Date: Mon, 13 Aug 2007 14:14:49 -0700 (PDT)

Hi all.

I'm trying to get the attributed title of an
NSMenuItem like this:

// button is an NSPopUpButton created in IB
NSMenuItem *firstItem = [[button menu] itemAtIndex:
0];
NSAttributedString *firstsAttributes = [firstItem
attributedTitle];
NSDictionary *firstsDictionary = [firstsAttributes
attributesAtIndex: 0 effectiveRange: NULL];
NSSize firstsSize = [firstsAttributes size];

NSLog (@"firstsDictionary is %d big.",
[firstsDictionary count]);
// this prints "firstsDictionary is 0 big."

NSLog (@"firsts W: %f H: %f", firstsSize.width,
firstsSize.height);
// this prints "firsts W: 0.000000 H: 0.000000"

NSLog (@"firsts attributedstring title: '%@'",
[firstsAttributes string]);
// this prints "firsts attributedstring title:
'(null)'"

NSLog (@"firsts title: '%@'", [firstItem title]);
// this prints "firsts title: 'Item0'"

Why does the NSAttributedString have no attributes?
How can I get the size of an NSMenuItem? (This is the
ultimate goal for now.)

Any help would be greatly appreciated.
_______________________________________________

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

  • Prev by Date: Re: Cocoa and PICT
  • Next by Date: CoreData, image storage - NSImage or CGImage?
  • Previous by thread: Re: NSBundle pathForResource:ofType:
  • Next by thread: CoreData, image storage - NSImage or CGImage?
  • Index(es):
    • Date
    • Thread