• 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
NSLayoutManager subclass - change the bounds of an attributed string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSLayoutManager subclass - change the bounds of an attributed string


  • Subject: NSLayoutManager subclass - change the bounds of an attributed string
  • From: Alex Kac <email@hidden>
  • Date: Sun, 23 Mar 2014 00:15:31 -0600

I’m learning here as I go using TextKit on iOS (and soon for OS X). I’ve created an attributed name for an NSAttributedString that essentially i want drawn as a background rounded rect for the text in the attributed string. To do this I’ve subclasses NSLayoutManager and used that for UITextView. And it works fine in general.

https://www.dropbox.com/s/l7j3wbnaz4r7coi/Screenshot 2014-03-23 00.11.32.png

However the problem of course is that I’d like the bounds of the text when using this attribute to increase so that it looks nicer. Now I’m a bit lost. I’m unsure if I’m supposed to subclass other methods in NSLayoutManager to do this, or if I’m to do something else. I’m not totally sure what to search for in the docs.

My best guess is
- (CGRect)boundingRectForGlyphRange:(NSRange)glyphRange inTextContainer:(NSTextContainer *)container;

but some pointers would be nice :)




_______________________________________________

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: NSLayoutManager subclass - change the bounds of an attributed string
      • From: Alex Kac <email@hidden>
  • Prev by Date: Re: Problems binding NSViewController's representedObject
  • Next by Date: Re: NSLayoutManager subclass - change the bounds of an attributed string
  • Previous by thread: Re: Problems binding NSViewController's representedObject
  • Next by thread: Re: NSLayoutManager subclass - change the bounds of an attributed string
  • Index(es):
    • Date
    • Thread