Questions tagged [textkit]

Text Kit is, collectively, a set of classes and protocols in iOS 7's UIKit framework that provide high-quality typographical services.

Text Kit, introduced in iOS 7, is a set of classes and protocols providing high quality typographical services including text layout, storage and display. It also enables direct control of typographical features such as kerning, ligatures, line break behaviour and justification. Text-related UIKit classes in iOS 7 - namely UITextView, UITextField and UILabel - are based on the Text Kit layout engine.

Allowing fine-grained control of fonts and styles through a mechanism Apple calls "Dynamic Type", Text Kit brings a much more refined an detailed system for text-handling to iOS.

272 questions
1
vote
1 answer

NSTextAttachment and touch events

I have a UITextView (in edit mode) with few images (as NSTextAttachment). I'd like to intercept touch events on these. I have set a delegate on the UITextView but textView:shouldInteractWithTextAttachment:inRange: is never called. (from the forums…
Sandeep Chayapathi
  • 1,490
  • 2
  • 13
  • 31
1
vote
0 answers

NSTextAttachment with text flowing around it

I have a TextKit based editor with support to adding images. I want to show each image on separate lines. My code looks like this (Thank you TextEdit), in my subclass of NSTextStorage - (void)addImageAssets:(NSArray *)allAssets…
Sandeep Chayapathi
  • 1,490
  • 2
  • 13
  • 31
1
vote
1 answer

Magnifying glass and edit menu won't appear in a paged scrollview using TextKit

I create a paged UIScrollView and fill its contents with text, using TextKit. All the paging works perfectly. What has me stumped is that when all of the text fits into one page, everything works as expected. However, if the text is longer and…
BFeher
  • 557
  • 5
  • 12
1
vote
2 answers

Three Column Table embedded in UITextView

My project consists of displaying a document in a UITextView. Most of the document is pretty straight forward attributed text and I have that working just fine. There are other parts of the document that consist of normal text and then a 3 column…
1
vote
2 answers

iOS7 UITextView with multiple paragraph styles from file

I am working on an in-app guide for my app where I want to layout some headings and paragraphs of text that support Dynamic Type. What is the simplest method to with a single UITextView? (The text is Preferably loaded from a separate text…
Jakob Halskov
  • 428
  • 6
  • 22
1
vote
1 answer

Replace NSTextattachement Image on NSMutableattributedString

I'm building an UITextView with text and images (Subclassing NSTextstorage for displaying my content) I'm having textcontent with images URLs. So my problem is that i need download all the images if they're not cached. So i want to first insert a…
1
vote
2 answers

iOS 7 Text Kit: When has NSLayoutManager filled its last NSTextContainer?

I'm using Text Kit in combination with UIPageViewController to create a book. The original text is stored in a text file (.html) and placed into a NSTextStorage. The [NSLayoutManager addTextContainer:(NSTextContaner*)txt] method works great, but…
RMH
  • 801
  • 2
  • 8
  • 17
1
vote
0 answers

Parsing HTML hpple replacing [element raw]

I'm having an issue using hpple library for parsing an HTML content. I want to use textkit to display a good html content. So here's my issue. I want to replace all image or video tags with my own tag and then instert it with textkit on an…
Pwyll28
  • 117
  • 11
1
vote
2 answers

How to make UITableView row height respond to user's preferred text size (Dynamic Type)?

I would like the UITableView's row height to respond to changes in the user's preferred text size. For example, when the preferred text size increases, I would like to increase the row height by a proportional amount. Here's what I have so far: -…
bilobatum
  • 8,918
  • 6
  • 36
  • 50
1
vote
1 answer

Invalidating glyphs in TextKit

I'm attempting to implement a text folding effect to hide some of the text in a UITextView based on attributes in the text storage and then setting those glyph properties to NSGlyphPropertyNull in the layoutManager: shouldGenerateGlyphs: properties:…
michaelkent94
  • 201
  • 1
  • 8
1
vote
0 answers

TextKit drawing excess at top of graphics context

I'm drawing directly into a graphics context by constructing the iOS 7 Text Kit "stack" of classes myself and asking for the glyphs to be drawn. This is my custom UIView subclass's drawRect: implementation: NSLayoutManager* lm = [NSLayoutManager…
matt
  • 515,959
  • 87
  • 875
  • 1,141
1
vote
1 answer

Caret disappears on long pressing blank space in UITextView and Text Kit

I'm using Text Kit to render some rich text on a text view. My problem is there seems to be a bug in iOS 7 for caret placement. Whenever you long press on a blank area in a text view the caret seems to disappear and no pop over menu with (Cut,…
Tanmay
  • 46
  • 5
1
vote
0 answers

iOS UITextView: How to create a double-spaced input text field?

This is a follow up to this question. I'm trying to create a double-spaced UITextView for entering text. In my custom UITextView, I've overwritten and -caretRectForPosition: to limit the height of the cursor. But now when I select text, the height…
cdownie
  • 239
  • 2
  • 8
0
votes
0 answers

How to fix HTML layout issues in an NSTextView on macOS Sonoma?

On macOS Sonoma (23A5312d) there are HTML table layout issues when using an NSAttributedString in an NSTextView. Consider the following Swift code: override func viewDidLoad() { super.viewDidLoad() let html = """
Dave
  • 479
  • 3
  • 13
0
votes
0 answers

Incorrect rendering when using NSTextView with TextKit 1

I encountered some issues with rendering in NSTextView. When I'm hitting enter the last line rendering is lagging and the line is not visible. Also, sometimes when I hit backspace the last line is temporarily duplicated. The problem is presented on…
Wojciech Kulik
  • 7,823
  • 6
  • 41
  • 67