nslayoutmanager Questions

2

I’ve got a custom NSLayoutManager subclass I’m using to draw pill-shaped tokens. I draw these tokens for substrings with a custom attribute (TokenAttribute). I can draw no problem. However, I need...
Leix asked 29/12, 2015 at 3:35

9

I have a problem that boundingRectForGlyphRange always returns CGRect.zero "0.0, 0.0, 0.0, 0.0". For example, I am coding for touching on a part of text of UILabel feature. My text has fi...
Illaffected asked 16/3, 2016 at 17:38

2

On this thread, Core Text calculate letter frame in iOS, they were able to calculate the frame of each glyph very precisely using Core Text. The final rects hug the actual drawn glyphs perfectly. ...
Beagle asked 13/2, 2014 at 19:59

3

Solved

Following the apple documentation I am trying to set up a simple NSTextView via its two constructor methods. I am placing the below code inside the viewDidAppear method of the view controller of ...
Toilet asked 13/3, 2015 at 14:55

2

Solved

I am working on a rich text editor in a Mac app that uses Markdown syntax. I use NSTextStorage to watch for matches in Markdown syntax, then apply styles to the NSAttributedString in real time like...
Iphigeniah asked 12/8, 2019 at 20:39

2

NSTextContainer on Mac OS X has a method replaceLayoutManager: to replace the NSLayoutManager of NSTextView with a subclass of NSLayoutManager. Unfortunately iOS doesn't have such a function. I t...
Teheran asked 3/1, 2014 at 17:54

1

I am trying to create a custom NSTextBlock, much like the one Apple did at WWDC 18 (23 mins in). Full demo project here. Okay, so it works great when I'm editing and marking a paragraph with my ...
Lecherous asked 30/10, 2019 at 8:10

2

The default layout manager fills in the background color (specified via NSAttributedString .backgroundColor attribute) where there's no text (except for the last line). I've managed to achieve t...
Arse asked 12/11, 2018 at 13:39

2

Solved

Using Swift, I want to get the boundingRect of a glyph, in draw#rect in a UILabel. The UILabel already has a size (say 300x300 in the example) and qualities such as the text being centered. class...
Eyebrow asked 8/7, 2019 at 13:23

3

I'm trying to implement a very simple text editor that should work both with NSTextView on macOS and UITextView on iOS. This text editor has a toolbar button "Section Break" that inserts a new sect...
Quoit asked 20/3, 2019 at 14:35

0

My ultimate goal is to give the user the ability to split a text inside an NSTextView or UITextView into several sections, where two subsequent sections are visually separated by a custom view sepa...

3

I'd like to get the index for the tapped character on a UILabel. I've subclassed a UILabel. In my awakeFromNib() I have this: layoutManager = NSLayoutManager() textStorage = NSTextStorage(attrib...

1

I want to be able to save the current text and visible region of an NSTextView and restore it. Using visibleRect and scrollRectToVisible: seems to deliver inconsistent results. If I just do: - (vo...
Clipped asked 11/4, 2013 at 18:48

1

Solved

Looking at the documentation for NSLayoutManager, specifically the drawUnderlineForGlyphRange:underlineType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin: method, I noticed...
Botfly asked 25/3, 2016 at 11:4

1

In session 220 (Advanced Text Layouts and Effects with Text Kit) of WWDC 2013 they specifically say NSLayoutManager can be used in conjunction with NSTextStorage and NSTextContainer to create advan...
Amando asked 11/7, 2015 at 12:29

0

I'm finishing a nice app with a relatively small text editor. During implementation of the syntax highlight I found myself in need to change foreground colour attribute of recognized tokens. I noti...
Diptych asked 23/7, 2016 at 14:41

1

Solved

Is there a way in AppKit to measure the width of a large number of NSString objects(say a million) really fast? I have tried 3 different ways to do this: [NSString sizeWithAttributes:] [NSAttrib...

1

I have a UIImage that contains multiple image frames and a duration which was sliced together from an animated GIF file. If I load the image in a UIWebView it will animate as expected, but I want t...
Remy asked 29/4, 2015 at 16:21

1

In order to support the UIAccessibilityReadingContent protocol, I need my UITextView to answer me questions about its lines. These are the methods of the protocol that I need to implement: access...
Apperceive asked 2/4, 2014 at 10:3

2

I am building a note editor using the Text Kit in ios7. Earlier I had trouble in rendering of custom size NSTextAttachment's as it was slowing down the rendering to a great extent.I solved the issu...
Selfknowledge asked 25/4, 2014 at 18:23

0

I'm trying to build a table view cell that has a UITextView. To reuse this table view cell, I set a new text storage to the layout manager. But adding the layout manager to the new text storage doe...
Kowtko asked 28/1, 2015 at 20:29

2

Solved

I've been creating UITextViews programatically, using auto layout, in iOS 7. Something like this: _textView = [UITextView new]; _textView.translatesAutoresizingMaskIntoConstraints = NO; _textView....
Selene asked 11/9, 2014 at 8:9

1

Even though the iOS doc says: NLayoutManager, NSTextStorage, and NSTextContainer can be accessed from subthreads as long as the app guarantees the access from a single thread. I encountered ...
Masson asked 1/5, 2014 at 2:50

1

Solved

Since Xcode 6 still has a lots of bugs with Swift, I'm not sure is it one or I'm missing something. My class adopts protocol NSLayoutManagerDelegate. But it seems impossible to override method I ne...
Accept asked 24/6, 2014 at 7:23

2

Solved

I have a bunch of NSTextViews that I would like to share a single selection. I basically want this to behave like selecting text on a web page, where there are multiple text views but you can drag ...

© 2022 - 2024 — McMap. All rights reserved.