Questions tagged [nsmutableattributedstring]
357 questions
0
votes
2 answers
How to Add Multiple Styles to One UITextView - like the iOS Notes App
I'd like to have the user style a UITextView with multiple styles by selecting the range and the style. To keep it simple right now, I have a UITextView and 2 UIButtons (bold and italic), but I'd love to add multiple styles (colors, size, font…

robinyapockets
- 363
- 5
- 21
0
votes
0 answers
NSMutableAttributedString hides part of a NSString - iOS
I have a NSString with this format:
When: Every day except Monday at 11:45am
Where: Main Pool
Get refreshed in the main pool during the warm sunny days whilst participating in our animation's fit activities. Enjoy our…

Student
- 418
- 1
- 4
- 17
0
votes
0 answers
replace contents of NSMutableAttributedString after appended
I want to change a contents of NSMutableAttributedString object which was already appended to anonter NSMutableAttributedString (which is displayed in UITextView).
The following code did not updating text on the screen:
var my_text =…

Pavel
- 363
- 1
- 2
- 14
0
votes
2 answers
Allocating the results of Reverse Geocoding to a global variable
I am using Swift 4 and Xcode 9.3.1. I'm including screenshots of the code.
I am new to mobile development/ programming in general and have been thinking about how to phrase this. So this is the best I can explain it:
I am building an app that gets…

MJoe
- 3
- 2
0
votes
1 answer
Variable sized range for NSMutableAttributedString
I have a label with the string shown below. I would like secondVariable to be a different color. I think I understand how to change the color. My problem is getting the range of secondVariable.
let str = "\(firstVariable) some random text…

squarehippo10
- 1,855
- 1
- 15
- 45
0
votes
0 answers
HTML entities in strings files
I wan't to customize the font of my strings for exemple I have 2 languages:
"Hello how are you $name ?"
"Bonjour comment vas tu $prenom ?"
Here for exemple I wan't to make :
"Hello" and "Bonjour" in bold;
"how" and "comment" in a custom font;
"are…

Ben
- 761
- 1
- 12
- 35
0
votes
0 answers
UITextView's attributeText lost attribute value
let myAttributedText = NSMutableAttributedString(string: string)
myAttributedText.addAttribute(NSAttributedStringKey(rawValue: keyName), value: binding, range: NSMakeRange(0, tokenAttributedText.length))
the NSObject is base of binding
let…

David Hu
- 44
- 7
0
votes
0 answers
How to split an NSMutableAttributedString based on it's UILabel's height?
I have a UILabel that contains an NSMutableAttributedString attached to it which was generated dynamically from a model.
What I'm looking to accomplish is if ever the UILabel's dynamic height reaches a specific height with the…

Jojo Narte
- 2,767
- 2
- 30
- 52
0
votes
1 answer
Add image to text background in iOS Swift
In my application I need to display image as background for particular character within string. It is possible in Swift? How can I do that?

Kavin Kumar Arumugam
- 1,792
- 3
- 28
- 47
0
votes
1 answer
NSAttributedString with two different text alignments
I'm trying to display some text in a UILabel using attributedText, with 2 different text alignments. I'm fetching the values from Firebase & they are key and value types. For some reason I can't get the title to be aligned left and the subtitle…

r3dm4n
- 1,175
- 2
- 18
- 33
0
votes
0 answers
need to create regular expression for dynamic words from array
I want to make regular expression for the dynamic words which comes from array and detect those word in array of string to make them linkable .
Eg. nsarray *arrOfStrings =@[@"This is sample string for objective c",@"Objective c or swift",@"Test…

Hancy Pipl
- 3
- 4
0
votes
1 answer
Adjusting vertical height of a character in an NSMutableAttributedString
I have an NSMutableAttributedString with a + in the first character that I want to lift 2 pts.
I can kern with this:
attributedAmountText.addAttribute(NSKernAttributeName, value: 2.0, range: NSRange(location: 0, length: 1))
Is there a way to lift…

Zack Shapiro
- 6,648
- 17
- 83
- 151
0
votes
1 answer
NSAttributedString on UIButton
let strNo = "2222555" // size 18, this should be bold
let remainingStr = "Call to" + "\(strNo)" + "Number"
Now, in my UIButton, say button, How to set this title "Call to 2222555 number" And i need to change the size according to device, so I…

Abhishek Mitra
- 3,335
- 4
- 25
- 46
0
votes
3 answers
Remove one part from AttributedText in UILabel
I have aUILabel which has attributed text set like
Good morning \n Alex
It shows as 2 lines in UILabel. I want to show this and after few seconds remove the Good morning part and just show the Alex part.
Is this possible to do?
Please help me

user1960169
- 3,533
- 12
- 39
- 61
0
votes
2 answers
replace specific text to the image using NSMutableAttributedString and regex
I want to replace "[img src=(IMAGE NAME)]" text to (IMAGE NAME) image.
but text replaced with blank. not an image. what should i do?
guard
let original = self.text
else { return }
let pattern = "\\[img src=(\\w+)\\]"
…

ltewarp0lleh
- 73
- 1
- 7