Questions tagged [nsmutableattributedstring]
357 questions
1
vote
0 answers
How can I determine that text is part of a string literal when writing a syntax highlighter
I am currently writing a library what will take a NSString and output an NSAttributedString that has been formatted for the specified language. I am planning on iterating through parts of the string using NSRange, but I have run into a few…

ahyattdev
- 529
- 1
- 6
- 18
1
vote
1 answer
NSMutableAttributedString can not change the text color when calling addAttribute method
i want to change the text color based on the 3rd part lib which is "TTTAttributedLabel" , but it does not make sense. Here is my code:
TTTAttributedLabel *priceInfoLabel.frame = [[TTTAttributedLabel alloc]…

Qijin
- 307
- 2
- 13
1
vote
0 answers
NSMutableAttributedString fails to get custom fonts from rtf file, on iOS 8
I'm using 3 custom fonts in my app (London,century-schoolbook,Jacob_bold). Using this code i set attributed text from file to textView.
NSMutableAttributedString *text1 =[NSMutableAttributedString.alloc
…

user2557885
- 69
- 4
1
vote
2 answers
NSTextAttachment image not displayed on iOS 8 devices (with iOS7.1 sdk)
I have just built my project on several iOS 8 devices with baseSDK set to iOS 7.1.
Unfortunately, all NSTextAttachment images added as attributes to relevant instances of NSMutableAttributedString are hidden on iOS 8 devices and the iOS 8 simulator…

loudmouth
- 1,946
- 1
- 12
- 16
1
vote
1 answer
Using NSMutableAttributedString in my UITextView but now user cannot edit text [cut, copy, delete]
Using NSMutableAttributedString to color my strings in UITextField, but then user cannot cut, copy, or delete the strings. For example, using the code below, if I type "blue red @green" then try to just delete out blue or cut out blue, when I try…

jdog
- 10,351
- 29
- 90
- 165
1
vote
0 answers
How to get a string to contain one font for one part, and another font for part 2?
Essentially, I am trying to create a string that looks like this:
Already have an account? Log in
I have tried reading thru the documentation for NSMutableAttributedString but I cant seem to find the answer I am looking for.
So far, I have my…

iBull
- 65
- 5
1
vote
2 answers
NSTextView making bold text using an array
I have an array which has the following structure:
(
[0] = (
[0] = @"Title string"
[1] = @"Some content string"
)
[1] = (
[0] = @"Title string"
[1] = @"Some content string"
)
[2] = (
…

SteppingHat
- 1,199
- 4
- 19
- 50
1
vote
3 answers
How do I bold multiple instances of a character in an NSString?
I have a string like the following :
NSString *a = @"* This is a text String \n * Followed by another text String \n * Followed by a third"
I need to print it as three lines. Now, I wanted the Asterix points in it to be bolded. So I tried…

gran_profaci
- 8,087
- 15
- 66
- 99
1
vote
1 answer
changing color of "label.text" range
iOS7 addAttribute:(NSString *)NSForegroundColorAttributeName value: can change label.text color
but in iOS6 will crash
iOS6 addAttribute:(NSString *)kCTForegroundColorAttributeName value: can not change label.text.color
How can I do?
-…

user_name
- 67
- 7
1
vote
1 answer
UITextView and NSMutableAttributedText
UITextView shows formatted text when I use NSAttributedString:
NSAttributedString* s1 =
[[NSAttributedString alloc] initWithString:@"Hello there!"
attributes:@{NSForegroundColorAttributeName:[UIColor redColor],…

Shmidt
- 16,436
- 18
- 88
- 136
1
vote
1 answer
text underline a different color than the text color in iOS
I'm currently using a UITextView and setting its attributedText property, but I can't see a way to set the underline color different from the text color using my NSMutableAttributedString. Am I just missing something? Is this possible?
Do I need to…

livingtech
- 3,570
- 29
- 42
1
vote
1 answer
Removing brackets from UILabel in iOS
I posted this question yesterday:Removing parentheses from the string in iOS. But I am not still able to remove the brackets from the label.
Not sure what my mistake. Spent the whole night figuring, still not able to do so.
I am using…

lakshmen
- 28,346
- 66
- 178
- 276
1
vote
3 answers
How to remove text from NSMutableAttributedString
I need to remove some text from NSMutableAttributedString.
My code looks like this:
[attributedLabel setText:string afterInheritingLabelAttributesAndConfiguringWithBlock:^NSMutableAttributedString *(NSMutableAttributedString…

lakshmen
- 28,346
- 66
- 178
- 276
0
votes
0 answers
Swift 5: UITextField attributedText doesnt update when currency change
I have this CurrencyTextfield which is a CurrencyTextFieldRepresentable because I'm using it inside a SwiftUI view.
I have an attributed string that I am updating in the init into setStyles() and in editingChanged(), the problem in when I change the…

akitainu22
- 95
- 1
- 8
0
votes
1 answer
How to Display NSMutableAttributedString with updates in SwiftUI
I want a NSMutableAttributedString do display a String where only on char has an other Color. After seraching i just found a examples to use NSMutableAttributedString on IOS but nothing suits for me.
import SwiftUI
struct SpritzViewMac: View {
…

Martin01
- 3
- 1