Questions tagged [nsmutableattributedstring]
357 questions
0
votes
0 answers
Objective C - Change font of attributed string from HTML text with it's own style
I am dynamically getting an HTML string from Server and parsing it to an Attributed String to show it in my app.
Since the string has its own styles, it shows different fonts and sizes, something that is affecting our design choices.
Some text is…

Fazle Rabbi Linkon
- 19
- 6
0
votes
0 answers
TextView Delegate Method Not Being Called
All of my code except for the delegate method is working fine (I added the extra code for context) but you can ignore that if you want and focus on the ifs/else ifs and the delegate method.
The delegate method is supposed to be called when a link is…

Neel1005
- 11
- 2
0
votes
1 answer
How to Align Text with NSAttributedString in swift
I am looking for align Text in NSAttributedString. It should be on same indent(List of string on same Column).
Output:
I have used below code
func setAttributedText() {
let image1Attachment = NSTextAttachment()
…

Amit
- 556
- 1
- 7
- 24
0
votes
1 answer
Can we restrict the width of a NSMutableAttributedString?
I have a string Ex: Arya said "We must find a solution" yesterday. Here I want to restrict the width of the text in bold ("We must find a solution") to 100, but others must not be shortened. So I added it as 3 different NSMutableAttributedStrings…

KP1
- 69
- 7
0
votes
0 answers
Updating Attributed String Without Losing Previous Formatting
For the first time, I am working with attributed strings so please bear with me!
I have spent a lot of time on SO looking at various attributed string answers but I'm still not convinced I am doing the right thing and would appreciate any advice.
I…

Chris
- 247
- 1
- 4
- 17
0
votes
1 answer
Applying NSMutableAttributedString to a range of text
I have some text:
New Content - Published Today | 10 min read
I'd like to apply styles to everything after and including the pipe, so | 10 min read
I have tried the below but it has only styles the pipe itself.
func makeAttributedText(using…

Harry Blue
- 4,202
- 10
- 39
- 78
0
votes
1 answer
NSMutableAttributedString Using NSLinkAttributedName
Getting this from NSMutableAttributedString using the NSLinkAttributeName attribute.
Using a html file for the link name.
How to make the text area bigger.
-(NSMutableAttributedString *)attributedStringForLink:(NSString *)fullString
…

James Bonner
- 39
- 2
0
votes
0 answers
NSMutableAttributedString to make links clickable and show html formatting
Part of the App I'm building is a chat screen. I'm displaying chat messages as UITableViewCells that consist of simple UILables (holding the text) and a surrounding UIView (to display text within a little speech bubble). All pretty straight…

Bernhard Engl
- 243
- 1
- 2
- 12
0
votes
1 answer
TTTAttributedLabel, change of color works only the first time controller launches in Swift
self.descriptionLbl.text = actionReqdText
let labelString = self.descriptionLbl.text as! NSString
let contactRange1 = labelString.range(of: actionString1)
let contactRange2 = labelString.range(of: actionString2)
…

RenuR
- 57
- 4
0
votes
2 answers
Objective-C: Equivalent to stringWithFormat for NSMutableAttributedString
I am trying to add a hyperlink in a string. I have a localized string and I put %@ to format my string. When I add the attributed string into my string, the attributed format gives the raw result which is NSLink = "https://www.example.com". I could…

jorjj
- 1,479
- 4
- 20
- 36
0
votes
2 answers
Swift -How to change the color of a UIButton's NSMutableAttributedString after it has been set
I have 2 UIButtons and their titles and colors are initially set using NSMutableAttributedString. The text is 2 lines of text
I have a custom UISegmentedControl and when the segment is switched I need to change only the color of the buttons. The…

Lance Samaria
- 17,576
- 18
- 108
- 256
0
votes
1 answer
How to get the estimated size of a rectangle required to draw NSMutableAttributedString?
I am trying to get the estimated size of the rectangle required to draw out a NSMutableAttributedString. The numbers that come not does not make any sense to me. I have a UIViewController with a UIlabel (txtField), with a UIlabel.numberOfLines =…

johnDoe
- 709
- 11
- 29
0
votes
0 answers
NSMutableAttributedString not appending in IOS 13 works well in iOS 12 or below
Below code works well in iOS 12 or below, but fails to append in iOS 13, as it prints only First Line and fails to print Extra Text.
let formattedString = NSMutableAttributedString() …

geko
- 1
0
votes
1 answer
Setting particular font-size at the cursor point in UITextView with attributed text using Swift
I am trying to build a RichTextEditor using UITextView.
When I apply a different font size at the end of the text, it fails to update the font size for new text typed.
I am currently having the below code which I tried to make it work:
Rich text…

Anish Kumar
- 266
- 1
- 6
0
votes
3 answers
NSAttributedString not working as expected in iOS 13
I am using NSMutableAttributedString to show multi font and colour text in a label. NSMutableAttributedString is not working as expected in iOS 13, but same code works fine in iOS 11 and 12 versions.
let hdAttributedText =…

Suresh Vutukuru
- 211
- 2
- 8