Questions tagged [nsmutableattributedstring]
357 questions
0
votes
0 answers
Get Proper range of linkAttributed From mutableAttributedString string
I am using mutableAttributedString string in textview with attributed link text format. I am getting attributed link for two different attributed link without any space.
But I i am adding same text with attributed link type and then getting only…

BalKrishan Yadav
- 467
- 7
- 21
0
votes
0 answers
Attributed string loses attributes inside function
I have an attributed string I create like so:
let myMutableString = NSMutableAttributedString(
string: "Father order number:",
attributes: [NSFontAttributeName:UIFont(
name: "Helvetica Neue",
…

mjpablo23
- 681
- 1
- 7
- 23
0
votes
1 answer
NSMutableAttributedString how to place 1 big word and then 2 lines after
Please look at this picture:
Notice how "Strength" is in big font and then "is not" is smaller and "something" is even smaller. I know how I can alter fonts in NSMutableAttributedString. However I don't know how I can put the 1st line "is not…

sudoExclaimationExclaimation
- 7,992
- 10
- 47
- 105
0
votes
1 answer
iOS 10.3.1 update breaks some NSAttributedString properties?
I'm going to ask and then answer my own question in the hope that this will help someone.
Our app used NSMutableAttributedString to define a strikethrough attribute for certain parts of our string.
NSRange range = [fullString…

Peter Brockmann
- 3,594
- 3
- 28
- 28
0
votes
1 answer
Is it possible to assign different attributes to different characters in a string in UITextView?Swift 3
I placed a large text in a UITextView In Xcode in interface builder. Is it possible to assign different attributes (colors, headings, alignments..etc) to different parts of the string. Using MutableAttributedString would not work for me since the…

bibscy
- 2,598
- 4
- 34
- 82
0
votes
1 answer
Rounded corners to UILabel in NSMutableAttributedString
I have a variable text that has a background color and rounded corners. So I'm using UILabel with NSMutableAttributedString.
myAttributedString = NSMutableAttributedString(string:"hello")
…

Sneha
- 2,200
- 6
- 22
- 36
0
votes
1 answer
Swift 3 - Change the font of UITextView's selected text
I'm trying to apply formatting on the selected range of the textview. The problem is when the selected text format applied, the rest of text reset its format.
Here is my code:
if let text = textView.text {
if let textRange =…

NST
- 115
- 10
0
votes
1 answer
Ios Swift Toggle underline of attributed string
I hav written two fuction to Add underline to a String and remove underline :
I want to toggle underline with a button.
So how do I check if NSMutableAttributedString has underline attribute :
func addUlnTxtFnc(TxtPsgVal :String) ->…

Sujay U N
- 4,974
- 11
- 52
- 88
0
votes
1 answer
How do I start with an empty attributedString whenever the UITextView changes?
I am using attributed string to format a single character string for UITextView that will update whenever a button is clicked or a picker is moved. However, because I use attributedStringLine.append(attributedCharString) the attributedString…

Greg
- 1,750
- 2
- 29
- 56
0
votes
1 answer
Part of the label clickable and bold at the same time
import Foundation
import UIKit
extension NSMutableAttributedString {
@discardableResult
public func setAsLink(textToFind: NSMutableAttributedString, linkURL: String) -> Bool {
let foundRange = self.mutableString.range(of:…
user7455332
0
votes
4 answers
Adding color to a word in string using NSMutableAttributedString
I am trying to add color to 2 words in a string. This is the code I am using:
var HighScore:Int = 0
var CurrentScore:Int = 0
let stringOne = "You have managed to score \(CurrentScore). Current record is \(self.HighScore).…

Sibling Thor
- 57
- 1
- 6
0
votes
0 answers
Can't change Paragraph attributes and String Attributes at the same time
I can get either the NSMutableParagraphStyle line spacing working OR the NSMutableAttributedString to be the correct font,color and size, but I can't get them both at the same time.
let style = NSMutableParagraphStyle()
style.lineSpacing = 5
let…

Nick
- 71
- 2
- 11
0
votes
1 answer
How to maintain the position of the UITextview with NSMutableAttributedString after changing font attriibutes
I am allowing the user to do formatting of the NSMutableAttributedString text inside a UITextView. Formatting examples are: Bold, Italic, Change font etc.
The attribute changes are reflected correctly. However after the setAttributedText and…

sudoExclaimationExclaimation
- 7,992
- 10
- 47
- 105
0
votes
0 answers
NSAttributedString error: Type of expression is ambiguous without more context
class Markdown: NSObject {
func markdownString(stringForVideoDescription:NSString) -> NSMutableAttributedString {
var options = [NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType]
var error:NSError?
var markdown:NSString =…

jpgr
- 278
- 2
- 3
- 13
0
votes
1 answer
NSMutableAttributeString not working in iOS 10.0 in UIAlertController
Hello am using NSMutableAttributedString to show different fonts but with same size in UIAlertController, the problem here is it showing two different fonts which is correct but it also showing two different sizes.Here is my code
UIFont…

Nisar Ahmad
- 885
- 1
- 10
- 25