• 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
Unrecognized selector -[UIFont fontName]?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unrecognized selector -[UIFont fontName]?


  • Subject: Unrecognized selector -[UIFont fontName]?
  • From: Rick Mann <email@hidden>
  • Date: Mon, 15 Jul 2013 17:58:55 -0700

Are a UIFont and CTFont the same thing? Seems like it, in that my UILabel's default font property contains a CTFont. But if I try to access the fontName, I get an exception.

For this code:

{
	[self setFont: self.someUILabel.font];
}

- (void)
setFont: (UIFont*) inFont
{
	if (inFont == nil)
	{
		[self.currentAttrs removeObjectForKey: (NSString*) kCTFontAttributeName];
		return;
	}

	NSString* name = inFont.fontName;		//  Unrecognized selector
	...
}

I'm getting an unrecognized selector exception on that last line.

(lldb) po [[self someUILabel] font]
$11 = 0x0beaf3d0 CTFont <name: .HelveticaNeueUI, size: 14.000000, matrix: 0x0>
CTFontDescriptor <attributes: <CFBasicHash 0xbeaf190 [0x3ec14d8]>{type = mutable dict, count = 1,
entries =>
	1 : <CFString 0x189a838 [0x3ec14d8]>{contents = "NSFontNameAttribute"} = <CFString 0xbeaf7c0 [0x3ec14d8]>{contents = ".HelveticaNeueUI"}
}


--
Rick




_______________________________________________

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: Unrecognized selector -[UIFont fontName]?
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: Converting RTFD to Word with embedded images
  • Next by Date: Re: Unrecognized selector -[UIFont fontName]?
  • Previous by thread: Re: Curious about a property being declared in the .h and the .m file for iOS
  • Next by thread: Re: Unrecognized selector -[UIFont fontName]?
  • Index(es):
    • Date
    • Thread