Questions tagged [nsmutableattributedstring]
357 questions
0
votes
1 answer
Objective-C NSMutableAttributedString text4 font is not showing correct font
I am trying to change font size, but there something wrong with my code? I can able to set font size of text1 to text3 but text4 isn't able to work and doesn't change font size to 16.
text1 text2 text3 text4
NSString *String1 = [NSString…
0
votes
3 answers
Clickable link within NSMutableAttributedString needs to show another viewcontroller / storyboard
I have a UITextView and NSMutableAttributedString which has a clickable link. I need this to show another storyboard but not quite sure how I could do this.
What I have so far works for external links but not a storyboard. Any help would be…

CIB
- 535
- 1
- 12
- 35
0
votes
2 answers
Get NSAttributed String color on tap SWIFT
I'm using a UITextView which contains multiple colors. I'm using NSMutableAttributedString for this. I'm fetching the words by tapping on the word inside the TextView in console. Now I want to fetch the color of the attributed string along with the…
0
votes
2 answers
Make half of the TextView's text color Different than other 50% of the text SWIFT
I've got a large text in my UITextView and I want to make the 50% of the text's color red and the other 50% green . I've added NSMutableAttributedString in the TextView but it works's for the full range of the text . How to divide the textView's…
0
votes
1 answer
Enumerate over a Mutable Attributed String (Underline Button)
I am trying to create a UIButton that allows the selected text to be underlined. This is my current code:
func underline() {
if let textRange = selectedRange {
let attributedString = NSMutableAttributedString(attributedString:…

a.wip
- 69
- 12
0
votes
1 answer
NSMutableAttributedString: Ambiguous use of 'init(string:attributes:)'
I am trying to run the code I wrote some months ago. Now I use Swift 4.2/Xcode 10.1. I get the error Ambiguous use of 'init(string:attributes:)' on
let mutableAttributedString = NSMutableAttributedString(string: "", attributes: [:])
I also use…

Roman Podymov
- 4,168
- 4
- 30
- 57
0
votes
0 answers
Swift NSMutableAttributedString NSMutableParagraphStyle firstLineHeadIndent left spacing issue
Want to add left margin spacing with NSMutableAttributedString NSMutableParagraphStyle & firstLineHeadIndent but no luck, firstLineHeadIndent or headIndent does't take effect
my implementation:
lazy var priseField: UILabel = {
let label =…

Hattori Hanzō
- 2,349
- 4
- 19
- 36
0
votes
1 answer
NSMutableAttributedString addAttribute for range apply for all string
I have created NSMutableAttributedString with different attributes and then for one range I added attribute with bold font. Example
let attText = NSMutableAttributedString(string: string, attributes: [
NSAttributedString.Key.font:…

juramoshkov
- 7
- 1
- 5
0
votes
1 answer
Why does my playground crash on NSRange()
I'm trying to learn about NSMutableAttributedString and NSAttributedString so I've created a simple playground to try some things. However, I have a couple of issues I can't figure out even after looking at a lot of examples on SO (like here and…

Jim
- 1,260
- 15
- 37
0
votes
0 answers
NSMutableAttributedString to an array
The desired thing here is to strikethrough a task in a tableview by using the NSMutableAttributedString. The issue is that I don't know how to apply this effect on the array / identify the task in the array.
Everything works smooth but I do not know…

Robert Cristian
- 125
- 5
0
votes
0 answers
How do I make NSMutableAttributedString work for links?
I'm using NSMutableAttributedString to format text strings. It works fine, even with the links. But for some reason the font size for the links won't change even though I have specified the size. My function looks like this: (There are comments in…

tore
- 619
- 2
- 9
- 23
0
votes
1 answer
How do I get multiple attributions from the same function?
I'm using attributed text like this:
let formated = textAnhorig.formatHyperlink(text: "click HERE and HERE", link: www.test.com, linkStart: 6, linkEnd: 9)
detailText.attributedText = formated
Using this function:
func formatHyperlink(text: String,…

tore
- 619
- 2
- 9
- 23
0
votes
0 answers
Where is italics and bold in NSMutableAttributedString (Xcode)?
I have a large string and I want parts of it to be in italics or bold. I have successfully used NSMutableAttributedString to change certain properties. See below:
let attributedString = NSMutableAttributedString.init(string: "Testing Bold")
…

tore
- 619
- 2
- 9
- 23
0
votes
1 answer
NSmutablestring with 2 line breaks crash the program
I need to create an Nsmutableattributed String that starts with line break, the code are like below:
let dateString = TimeUtils.formatTimeOnly(from: data.date!)
let dateMutableString = NSMutableAttributedString.init(string: "\n\(dateString)")
let…

kiki
- 41
- 1
- 10
0
votes
1 answer
Swift finding and changing range in attributed string
What would be the best way to change this string:
"gain quickness for 5 seconds. (Cooldown: 90s) only after"
into an Attributed String while getting rid of the part in the <> and I want to change the font of (Cooldown: 90s). I know…

Joshua Guenard
- 33
- 4