 Text Kit is a high-level, feature-rich set of
classes that has all the characteristics for
fine typography to handle tex...
The developers can make use of the following
classes:
 NSAttributedString
 NSLayoutManager
 NSTextContainer
 NSTextSto...
 The UIKit framework adds methods
to NSAttributedString to support the drawing
of styled strings and to compute the size ...
 Creating an Attributed String
– initWithData:options:documentAttributes:error:
– initWithFileURL:options:documentAttribu...
 The NSTextStorage class defines the fundamental
interface for managing text-based content.
 Framework/System/Library/Fr...
 Setting the Delegate
delegate property
 Determining the Nature of Changes
editedMask property
changeInLength property
e...
 Handling Text Edited Messages
– edited:range:changeInLength:
– ensureAttributesAreFixedInRange:
– invalidateAttributesIn...
 The NSTextContainer class defines a region where
text is laid out
 Framework/System/Library/Frameworks/UIKit.frame
work...
 Laying Out Text
layoutManager property
 Defining the Container Shape
exclusionPaths property
size property
lineBreakMod...
 Creating a Text Container
– initWithSize:
 Laying Out Text
–
lineFragmentRectForProposedRect:atIndex:w
ritingDirection:...
 The NSLayoutManager class generates glyphs and lays
out text
 Framework/System/Library/Frameworks/UIKit.frame
work
 An...
 Text Storage
textStorage property
 Text Containers
textContainers property
 Delegate
delegate property
 Global Layout...
 Getting Glyphs and Glyph Properties
numberOfGlyphs property
 Getting Layout Information
extraLineFragmentRect property
...
 Text Containers
– addTextContainer:– insertTextContainer:atIndex:
– removeTextContainerAtIndex:
– setTextContainer:forGl...
 Causing Glyph Generation and Layout
– ensureGlyphsForCharacterRange:
– ensureGlyphsForGlyphRange:
ensureLayoutForBoundin...
 Getting Glyphs and Glyph Properties
– characterIndexForGlyphAtIndex:
– getGlyphsInRange:glyphs:properties:characterIndex...
 Getting Layout Information
– attachmentSizeForGlyphAtIndex:
– drawsOutsideLineFragmentForGlyphAtIndex:
– firstUnlaidChar...
 Advanced Layout Queries
– boundingRectForGlyphRange:inTextContainer:
– characterIndexForPoint:inTextContainer:fractionOf...
 Supporting Drawing
– drawBackgroundForGlyphRange:atPoint:
– drawGlyphsForGlyphRange:atPoint:
–
drawStrikethroughForGlyph...
 Lesser Build Size due to lesser use of graphics
to display textual images
 Lesser Coding i.e concatenation of two
label...
Text kit ios7
Text kit ios7
Upcoming SlideShare
Loading in …5
×

Text kit ios7

1,915 views

Published on

Published in: Technology, Business
1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total views
1,915
On SlideShare
0
From Embeds
0
Number of Embeds
15
Actions
Shares
0
Downloads
5
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide

Text kit ios7

  1. 1.  Text Kit is a high-level, feature-rich set of classes that has all the characteristics for fine typography to handle text  The developers can add different styles and formatting to the text, such as columns, multiple fonts, paragraphs, and pages  It’s responsible for creating, editing, displaying, and storing text with less code, as it’s integrated with all UIKit text-based controls
  2. 2. The developers can make use of the following classes:  NSAttributedString  NSLayoutManager  NSTextContainer  NSTextStorage
  3. 3.  The UIKit framework adds methods to NSAttributedString to support the drawing of styled strings and to compute the size and metrics of a string prior to drawing  The NSAttributedString class has been extended to support new attributes  Framework/System/Library/Frameworks/UI Kit.framework
  4. 4.  Creating an Attributed String – initWithData:options:documentAttributes:error: – initWithFileURL:options:documentAttributes:error:  Drawing the String – drawAtPoint: – drawInRect: – drawWithRect:options:context:  Getting Metrics for the String – size – boundingRectWithSize:options:context:  Generating Data – dataFromRange:documentAttributes:error: – fileWrapperFromRange:documentAttributes:error:
  5. 5.  The NSTextStorage class defines the fundamental interface for managing text-based content.  Framework/System/Library/Frameworks/UIKit.f ramework  NSTextStorage is a semiconcrete subclass of NSMutableAttributedString that manages a set of client NSLayoutManager objects, notifying them of any changes to its characters or attributes so that they can relay and redisplay the text as needed  NSTextStorage defines the fundamental storage mechanism of the Text Kit’s extended text- handling system
  6. 6.  Setting the Delegate delegate property  Determining the Nature of Changes editedMask property changeInLength property editedRange property  Handling Text Edited Messages fixesAttributesLazily property  Handling Layout Managers layoutManagers property
  7. 7.  Handling Text Edited Messages – edited:range:changeInLength: – ensureAttributesAreFixedInRange: – invalidateAttributesInRange: – processEditing  Handling Layout Managers – addLayoutManager: – removeLayoutManager:
  8. 8.  The NSTextContainer class defines a region where text is laid out  Framework/System/Library/Frameworks/UIKit.frame work  The NSTextContainer class defines a region in which text is laid out  An NSLayoutManager object uses one or more NSTextContainer objects to determine where to break lines, lay out portions of text, and so on  An NSTextContainer object defines rectangular regions, and you can define exclusion paths inside the text container's bounding rectangle so that text flows around the exclusion path as it is laid out  You can create subclasses that define regions of nonrectangular shapes, such as circular regions
  9. 9.  Laying Out Text layoutManager property  Defining the Container Shape exclusionPaths property size property lineBreakMode property  Synchronizing with the Text View heightTracksTextView property widthTracksTextView property  Constraining Layout maximumNumberOfLines property lineFragmentPadding property
  10. 10.  Creating a Text Container – initWithSize:  Laying Out Text – lineFragmentRectForProposedRect:atIndex:w ritingDirection:remainingRect:
  11. 11.  The NSLayoutManager class generates glyphs and lays out text  Framework/System/Library/Frameworks/UIKit.frame work  An NSLayoutManager object coordinates the layout and display of characters held in an NSTextStorage object  Maps Unicode character codes to glyphs, sets the glyphs in a series of NSTextContainer objects, and displays them in a series of text view objects  coordinates its text view objects, provides services to those text views to support editing paragraph styles, and handles the layout and display of text attributes not inherent in glyphs (such as underline or strikethrough
  12. 12.  Text Storage textStorage property  Text Containers textContainers property  Delegate delegate property  Global Layout Manager Options allowsNonContiguousLayout property hasNonContiguousLayout property hyphenationFactor property showsControlCharacters property showsInvisibleCharacters property usesFontLeading property
  13. 13.  Getting Glyphs and Glyph Properties numberOfGlyphs property  Getting Layout Information extraLineFragmentRect property extraLineFragmentTextContainer property extraLineFragmentUsedRect property
  14. 14.  Text Containers – addTextContainer:– insertTextContainer:atIndex: – removeTextContainerAtIndex: – setTextContainer:forGlyphRange: – textContainerChangedGeometry: textContainerForGlyphAtIndex:effectiveRange: – usedRectForTextContainer:  Invalidation of Layout and Glyphs – invalidateDisplayForCharacterRange: – invalidateDisplayForGlyphRange: – invalidateGlyphsForCharacterRange:changeInLength:actualChara cterRange: – invalidateLayoutForCharacterRange:actualCharacterRange: – processEditingForTextStorage:edited:range:changeInLength:inval idatedRange:
  15. 15.  Causing Glyph Generation and Layout – ensureGlyphsForCharacterRange: – ensureGlyphsForGlyphRange: ensureLayoutForBoundingRect:inTextContainer: – ensureLayoutForCharacterRange: – ensureLayoutForGlyphRange: – ensureLayoutForTextContainer:  Setting Glyphs and Glyph Properties setGlyphs:properties:characterIndexes:font:forGly phRange:
  16. 16.  Getting Glyphs and Glyph Properties – characterIndexForGlyphAtIndex: – getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels: – glyphAtIndex: – glyphAtIndex:isValidIndex: – glyphIndexForCharacterAtIndex: – isValidGlyphIndex: – propertyForGlyphAtIndex:  Setting Layout Information – setAttachmentSize:forGlyphRange: – setDrawsOutsideLineFragment:forGlyphAtIndex: – setExtraLineFragmentRect:usedRect:textContainer: – setLineFragmentRect:forGlyphRange:usedRect: – setLocation:forStartOfGlyphRange: – setNotShownAttribute:forGlyphAtIndex:
  17. 17.  Getting Layout Information – attachmentSizeForGlyphAtIndex: – drawsOutsideLineFragmentForGlyphAtIndex: – firstUnlaidCharacterIndex – firstUnlaidGlyphIndex – getFirstUnlaidCharacterIndex:glyphIndex: – lineFragmentRectForGlyphAtIndex:effectiveRange: – lineFragmentUsedRectForGlyphAtIndex:effectiveRan ge: – locationForGlyphAtIndex: – notShownAttributeForGlyphAtIndex: – truncatedGlyphRangeInLineFragmentForGlyphAtIndex:
  18. 18.  Advanced Layout Queries – boundingRectForGlyphRange:inTextContainer: – characterIndexForPoint:inTextContainer:fractionOfDistanceBetweenInsertionPoints: – characterRangeForGlyphRange:actualGlyphRange: – enumerateEnclosingRectsForGlyphRange:withinSelectedGlyphRange:inTextContainer :usingBlock: – enumerateLineFragmentsForGlyphRange:usingBlock: – fractionOfDistanceThroughGlyphForPoint:inTextContainer: – getLineFragmentInsertionPointsForCharacterAtIndex:alternatePositions:inDisplayOr der:positions:characterIndexes: – glyphIndexForPoint:inTextContainer: – glyphIndexForPoint:inTextContainer:fractionOfDistanceThroughGlyph: – glyphRangeForBoundingRect:inTextContainer: – glyphRangeForBoundingRectWithoutAdditionalLayout:inTextContainer: – glyphRangeForCharacterRange:actualCharacterRange: – glyphRangeForTextContainer: – rangeOfNominallySpacedGlyphsContainingIndex:
  19. 19.  Supporting Drawing – drawBackgroundForGlyphRange:atPoint: – drawGlyphsForGlyphRange:atPoint: – drawStrikethroughForGlyphRange:strikethroughType:baselineOffs et:lineFragmentRect:lineFragmentGlyphRange:containerOrigin: – drawUnderlineForGlyphRange:underlineType:baselineOffset:line FragmentRect:lineFragmentGlyphRange:containerOrigin: – fillBackgroundRectArray:count:forCharacterRange:color: – showCGGlyphs:positions:count:font:matrix:attributes:inContext: – strikethroughGlyphRange:strikethroughType:lineFragmentRect:li neFragmentGlyphRange:containerOrigin: – underlineGlyphRange:underlineType:lineFragmentRect:lineFragm entGlyphRange:containerOrigin:
  20. 20.  Lesser Build Size due to lesser use of graphics to display textual images  Lesser Coding i.e concatenation of two labels/strings with different layouts is not a headache now with the release of iOS 7

×