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
0
votes
1 answer

Adding Custom NSLayoutManager to UItextView that is created in Storyboard

I want to use the custom layout manager for a textview that is referenced from storyboard. I know that we can subclass the NSLayoutManager and assign the layout to textview in code but I want to use the textview from storyboard. I found in…
srividya
  • 419
  • 6
  • 16
0
votes
1 answer

Exclusion rects not shifting text properly with NSTextView/UITextView

I have an NSTextView with some exclusion rects so I can shift the text vertically without having to resort to adding newlines to the string. However, I've noticed that the exclusion rect is rather limited or perhaps even buggy because I cannot shift…
Andyy
  • 485
  • 8
  • 27
0
votes
0 answers

iOS:How to get the character at the click position on a UILabel

When I click on a UILabel, I want to get the character of the clicked position, but UILabel has no API,what should I do?
summer
  • 11
  • 1
0
votes
0 answers

Selection in NSTextView

I want to implement the following feature: In my NSTextView subclass I listen on option + arrow up and option + arrow down. Whenever these shortcuts are triggered the textviews selection should expand/collapse in the following manner: Cursor…
dehlen
  • 7,325
  • 4
  • 43
  • 71
0
votes
1 answer

Multiple UITextView inside UIScrollView in paging mode interaction problem

I am creating multiple UITextViews inside UIScrollView in paging mode based on textContainer. View structure All works as expected, but I want to make textView selectable. So of course I make it [textView setSelectable:YES]; while adding on…
Arty
  • 11
  • 3
0
votes
1 answer

Get font glyph metrics with Swift

In order to positioning / scaling font glyphs in a custom UIView I need to know some glyph metrics, such as: - ascent (height of the glyph from the base line, such as the part of "g" that stands over the base line) - descent (depth of the glyph from…
Luca
  • 303
  • 2
  • 13
0
votes
0 answers

Unable to detect click in UILabel on right characters in case label contains Emojis

I am using this method to detect click on hashtags and other attributed links in the UILabel. This code works fine by returning true value in most of the cases but in case the attributed text contains some unicodes like emojis then this methods…
Rishabh
  • 391
  • 3
  • 13
0
votes
1 answer

NSTextView's Insertion Point draws position exceptions

This should be a Bug, because I can reproduce it with my friends. I just set allowsNonContiguous Layout of NSTextView. layoutManager to true, and that's the problem. In the editor, I first enter N blank lines, that is, press N times to return.…
Simon
  • 438
  • 4
  • 14
0
votes
1 answer

Is there are way to determine text end coordinates in UILabel? (not label frame rect)

I need place some UIView right after text ends with some conditions: If there are enough space from text end to the right edge of container, place view right after. If there are no room - place view above. The problem is - it should work for second…
George
  • 643
  • 9
  • 23
0
votes
0 answers

Using NSAttributedString with multiple foregroundColor makes the text in UILabel look lower than expected

Demo https://github.com/NSFish/NSAttributedStringWithMultipleForegroundColor Description Here I have a UILabel as simple as it could be let label = UILabel() label.backgroundColor = UIColor.gray label.numberOfLines = 2 view.addSubview(label) //…
NSFish
  • 354
  • 3
  • 10
0
votes
1 answer

Swift `UIMenuController` custom action

I have implemented custom text view using TextKit. Also I have custom text selection implemented with UILongPressGesture. I've made progress in copying selected text with standard pop-up menu UIMenuController. I want to implement custom text…
deniz
  • 11
  • 6
0
votes
1 answer

Reusing UITextView inside UITableViewCell

I'm using UITextView to display some complex content (like text with different color, image, link etc.) inside a UITablViewCell. The content is first parsed into an NSTextStorage instance. Then the corresponding NSLayoutmanager and NSTextContianer…
kukushi
  • 647
  • 9
  • 22
0
votes
2 answers

The image is not displayed correctly in NSTextField

I want use the object - NSTextField to display an image. But the result isn't correct. the image size is 32x32. my code like this: class ViewController: NSViewController { var text: NSTextField! override func viewDidLoad() { …
Henry
  • 107
  • 1
  • 3
  • 10
0
votes
1 answer

Make bullet/num/check lists in UITextView

I am working on text editor app and using UITextView for this. Does anybody know how to make ability to do bullet/num/check lists in it? Any examples/tutorials? Note: I need to do this as a part of text editor, so user can select some area, tap on…
landonandrey
  • 1,271
  • 1
  • 16
  • 26
0
votes
1 answer

How to resize and layout image/attachment in TextKit?

I'm building a magazine app via TextKit, here is a TextKit demo (check out the developer branch). It loads a NSAttributeString from a rtfd file as text storage object, all the pages have the same size with custom NSTextContainer object, the…
Itachi
  • 5,777
  • 2
  • 37
  • 69