Questions tagged [nsmutableattributedstring]

357 questions
0
votes
1 answer

Attributed string click is not sensitive with UITextView

Clickable text is not sensitive when touching, need stay finger for a while to trigger that event. Is there a method to resolve that?
BollMose
  • 3,002
  • 4
  • 32
  • 41
0
votes
0 answers

_SwiftValue ctFontRef unrecognized selector sent to instance

This is the code : let sub1 = subsessions[0] let titleText = NSMutableAttributedString(string: String(format: "%@\n%@", session.Title, sub1.Subtitle)) titleText.addAttribute(NSFontAttributeName, value: UIFont(name: "AppleGaramond-Italic", size:…
Nitish
  • 13,845
  • 28
  • 135
  • 263
0
votes
1 answer

why does my font in UITextView changes style without a reason in swift?

I have a UITextView in my swift app and I'm setting up the font in viewDidLoad: let font = UIFont(name: "AppleSDGothicNeo-Light", size: 16.0) myTextView.font = font It works ok, when I run the app and writes something in the text view, I…
user3766930
  • 5,629
  • 10
  • 51
  • 104
0
votes
0 answers

NSRange setted automatically

I've to searching for in NSMutableAttributedString* textToAnalize; the number of characthers with a specific attribute. So in this code while (index<[[self textToAnalize]length]) { NSRange range; id value=[self.textToAnalize…
user5781472
0
votes
4 answers

How to extract a substring from a dynamic string in objective c?

I have a string like @"Greetings from Capt. Ashim Mittra,​ Vice President – Flight Operations" from which I want to extract “Capt. Ashim Mittra”. i.e. I want to start from the word “from” and read to “,” (comma)
raj
  • 39
  • 1
  • 10
0
votes
1 answer

write an add attribute method in objective C

Hi I am having troubles to write an custom method for adding attributes for NSMutableAttributeString by passing strings, int, and colour as parameters, I am getting three errors below, please help.. -(NSMutableAttributedString*)setAttributedSuits:…
Davy ho
  • 5
  • 3
0
votes
1 answer

Adding NSAttributedString to CloudKit

I need to add some NSAttributedString settings for text to CloudKit container. In CoreData I'm using Atribute type "Transformable". When I'm trying to add NSAttributedString to CloudKit I have a warning message in my console log: *** Terminating…
Skie
  • 91
  • 1
  • 2
  • 13
0
votes
1 answer

Swift replacement font size in NSMutableAttributedString

I have some attributes: var myAttributeMainText = [ NSFontAttributeName: UIFont(name: "Arial", size: 24.0)! ] var myAttributeUpperText = [ NSBaselineOffsetAttributeName: 8, NSFontAttributeName: UIFont(name: "Arial", size: 14.0)! ] I'm using those…
0
votes
0 answers

How to color all characters in a very long string in swift ?

I need to color the string like this “atcatagcatggcattcatagcgattcgat”, where each of “a”, “t”, “c”, “g” has own color. I can use NSMutableAttributedString and .addAttribute in a range, so first, I can find ranges of indexes for the characters as…
VYT
  • 1,071
  • 19
  • 35
0
votes
1 answer

UITextField getting from paste

When I pasted a text into my UITextField with attributed.text the font of the UITextField was also changed to the font that was pasted.
0
votes
1 answer

NSMutableAttributedString Fatal Exception: NSRangeException

When I try to apply attributes to the sub-string, I sometimes get a crash in following code: // Dummy strings let originalString = "Some example string" let searchSubString = "exam" // Get range of sub-string for which new attributes are to be…
0
votes
2 answers

NSMutableString is not working for HTML Text

Code is working fine..all the HTML tags also implemented but when i set attributes like font and color the HTML string convert into normal string.. NSString * htmlString = [NSString…
Balaji Gupta
  • 33
  • 1
  • 12
0
votes
1 answer

How to add the ellipsis after set the line spacing for UILabel?

I found that UILabel use set the line spacing, he no longer shows the size of the ellipsis even if he is not enough, I would like to know how to add the ellipsis let message:NSString = "Perhaps you are an average student with average…
aaron
  • 11
  • 3
0
votes
1 answer

NSMutableAttributedString can't setAttributes or addAttributes correctly

I have a method below that I want to use to change the color of the last 6 characters of a UILabel's text, which will be a date in parenthesis, i.e. (1999). First I set the text of a tableViewCell and then I get the attributedText property so I can…
se_puede_dev
  • 585
  • 7
  • 16
0
votes
1 answer

NSString find regular expression and replace it with image (NSMutableAttributeString)

I know that something like this has already been asked but I found no solution for my issue. So, I have a NSString, which sometimes includes in the text a image name, like: Lorem ipsum.... image.png ... dolor sit elit lamet I'd like to put in that…
BlackBox
  • 631
  • 1
  • 5
  • 19