nsattributedstring Questions

2

Solved

I want to convert NSAttributedString containing RTFD to uppercase without losing attributes of existing characters and graphics. Thanks,
Jemima asked 16/7, 2011 at 10:11

9

Solved

Say I have an NSMutableAttributedString . The string has a varied mix of formatting throughout: Here is an example: This string is hell to change in iOS, it really sucks. However, the font per se...
Clarethaclaretta asked 1/5, 2017 at 17:19

4

Solved

Going through some basic improvements to a application I am working on. Still new to the iOS swift development scene. I figured that the lines of text in my code would automatically be centered bec...
Swimming asked 30/10, 2015 at 18:52

2

I have an extension to convert HTML string to NSAttributedString. After iOS 15 is released, I've seen a lot of crashes from my user. All those crashes are on iOS 15 and occur on the main thread. He...
Spokane asked 27/9, 2021 at 1:14

3

As the title tells,now i can simple convert HTML into NSAttributedString with initWithHTML:documentAttributes: , but what i want to do here is reverse. Is there any 3rd party library to achieve thi...
Braze asked 14/3, 2011 at 11:54

3

Solved

I'm trying to implement Codable for a class which contains a NSAttributedString, but I get errors at compile time: try container.encode(str, forKey: .str) error ambiguous reference to member '...
Vertical asked 16/3, 2018 at 4:46

3

Solved

When using NSKernAttributeName it puts a space at the end of each line, is there any way to fix this? I can set the attributed to be in the range of: NSRange(location: 0, length: self.text!.charac...
Kkt asked 2/6, 2016 at 14:27

2

I am setting the attributed text of a label, and I am getting this strange error: Terminating app due to uncaught exception 'NSRangeException', reason: 'NSMutableRLEArray replaceObjectsInRange:wit...
Frankie asked 23/8, 2013 at 19:55

6

Solved

I would like to do a drop cap first character in a UILabel using the attributedText NSAttributedString property only. Like this: (source: interpretationbydesign.com) I have experimented with adjus...
Appalachian asked 8/1, 2013 at 12:24

24

Solved

I have a UITextView which displays an NSAttributedString. The textView's editable and selectable properties are both set to false. The attributedString contains a URL and I'd like to allow tapping...
Halloran asked 24/3, 2016 at 10:44

2

Solved

I want to style a text using NSAttributedString. The text should have a background and a custom padding, so that the text has a little bit of space to the background's edge. This is what I want to...
Petrarch asked 1/8, 2019 at 9:7

1

Does SwiftUI Text not work with NSTextAttachment? I have this AttributedString: var attributedString: AttributedString { var sampleAttributedString = AttributedString(sampleText) // Apply some bo...

6

Solved

How do you set all the attributes in an NSMutableAttributedString to nothing? Do you have to enumerate through them and remove them? I don't want to create a new one. I am working on the textStora...
Guttural asked 5/3, 2015 at 14:57

2

Solved

I have AttributedString with emoji like this "🤣🤣🤣 @Mervin tester 🤣🤣🤣" Now I need to find a range of Mervin in this attributed String. let attributedString = NSMutableAttributedString(strin...

5

How do you copy an NSAttributedString in the pasteboard, to allow the user to paste, or to paste programmatically (with - (void)paste:(id)sender, from UIResponderStandardEditActions protocol). I t...
Viridescent asked 26/9, 2012 at 11:46

1

Solved

When building for iOS 16.4, we noticed different behavior when it comes to using baselineOffset on an NSAttributedString. positive values are now handled differently than on previous iOS versions (...
Cymatium asked 24/4, 2023 at 9:11

5

Solved

Usually I build app interface in interface builder. Sometimes design requires to use attributed strings (fonts, colors and etc.). It's easy to configure if string is static. But if string is dynami...
Photomap asked 20/7, 2015 at 19:33

25

Solved

I am trying to get the rect for an attributed string, but the boundingRectWithSize call is not respecting the size I pass in and is returning a rect with a single line height as opposed to a large ...
Yetac asked 29/11, 2012 at 7:48

1

Solved

I'm working to replace NSAttributedString with AttributedString but have been unsuccessful in getting attachments to work. The image doesn't appear in the string despite the fact I applied the atta...
Sattler asked 20/2, 2023 at 18:53

9

Solved

I need to search some strings and set some attributes prior to merging the strings, so having NSStrings -> Concatenate them -> Make NSAttributedString is not an option, is there any way to concaten...
Govea asked 29/8, 2013 at 18:15

4

I have a multiline UILabel as shown here: I achieved this using the following code: label.lineBreakMode = .ByWordWrapping label.numberOfLines = 2 I'm trying to "decrease" the line spacing bet...
Euchology asked 26/1, 2016 at 19:16

4

Solved

I have an instance of NSData containing attributed text (NSAttributedString) originating from an NSTextView. I want to convert the attributed string to a plain string (NSString) without any formatt...
Catharina asked 26/1, 2012 at 12:46

4

Solved

I want the underline to be below the text like any other normal underlining mechanism. However, with NSAttributed string it leaves holes with "g's" and "y's" example: How it should look: How c...
Vibrate asked 30/12, 2014 at 18:22

0

I am converting an HTML string to an NSAttributedstring to set in TextView, while in text, there are bullet points with sub-bullet points. Bullet points are coming correctly but sub-bullet point al...
Surefire asked 29/12, 2022 at 6:16

4

I'm trying to show HTML in a UILabel, like NSString * htmlString = @"Some html string \n <font size=\"13\" color=\"red\">This is some text!</font>"; NSAttributedString * attrStr = [[N...
Isagogics asked 14/12, 2015 at 9:43

© 2022 - 2025 — McMap. All rights reserved.