Questions tagged [nsmutableattributedstring]

357 questions
0
votes
1 answer

Bold part of the text in UITextView in Swift using NSMutableAttributedString

I'm trying to bold part of a text in a UITextView. Here is the code I'm using (though I simplified the text): @IBOutlet weak var textview: UITextView! /*...*/ var str : NSMutableAttributedString = NSMutableAttributedString(string:"this is a test",…
Lyra
  • 301
  • 1
  • 4
  • 19
0
votes
1 answer

How can I save NSMutableAttributedString with additional text description as rtf file, in swift ?

I have text as NSMutableAttributedString and I can save as rtf file. Let say in this text I have marked one line with red background color. I would like to make additional text description for this marked line. How can I save this description into…
VYT
  • 1,071
  • 19
  • 35
0
votes
1 answer

Out of bound error adding link to nsattributedstrings in iOS

I have the following code setup in iOS using objective C, however the part addint the link only works for ranges starting at 30 or less. The length of short_content should always be at least 100 words. NSString *short_content = [self…
0
votes
1 answer

Adding string attributes to dynamic labels

I am trying to set the colour of a static part of the text in a UILabel while the dynamic part turns into the highscore. There seems to be conflict between the statement that sets the colour and the statement that sets the highscore. These lines in…
Tim
  • 583
  • 1
  • 6
  • 18
0
votes
1 answer

how to store NSMutableAttributedString to an array

I am trying to customize a string "Add as Event 1"("Event 1" is bold) and then store the string to a mutable array. Here is my codes: NSString *string1 = @"Add as Event 1"; NSMutableArray *eventsData; NSMutableAttributedString *attrString1 =…
Jennifer He
  • 75
  • 1
  • 2
  • 10
0
votes
1 answer

-[__NSCFString _getValue:forType:]: unrecognized selector sent to instance

NSMutableAttributedString *attString = [[NSMutableAttributedString alloc] initWithString:timeString]; UIFont *font = [UIFont fontWithName:self.txtFieldForEndTime.font.familyName size:self.txtFieldForEndTime.font.pointSize / 2]; NSDictionary…
0
votes
1 answer

ios NSMutableAttributedString NSKernAttributeName wrong kerning with "fl" and "fi" letters

I'm using attributed strings on labels to change the spacing between letters: var attributedString=NSMutableAttributedString(string: "Fifi floflo") attributedString.addAttribute(NSKernAttributeName, value: CGFloat(10), range: NSRange(location: 0,…
Marie Dm
  • 2,637
  • 3
  • 24
  • 43
0
votes
1 answer

unable to set custom font in NSMutableAttributedString

I am unable to set custom font in NSMutableAttributedString But when setting font to System it's working fine. Here is my code: NSString *str=@"my attributed text"; NSMutableAttributedString *attString=[[NSMutableAttributedString alloc]…
0
votes
1 answer

How to make a string with multiple parts which can be touched in iOS?

I want to create a string which consists of 3 parts: the username some static string the post For example: Thomas has liked Offical Stackoverflow Page The user should be then able to click either on 'Thomas' which redirects him to the profile of…
eav
  • 2,123
  • 7
  • 25
  • 34
0
votes
1 answer

Attributed Text not Changing Fonts

I'm using attributed text (NSMutableAttributedString, to be exact) to display text that can be either italicized, bold, or have a hyperlink (sometimes combinations of these come up as well). When I did this with UILabel it displayed exactly as I…
Cody Harness
  • 1,116
  • 3
  • 18
  • 37
0
votes
1 answer

Facing crash to check special character in NSMutableAttributedString

I have a NSString stored in cell.lblTitle.text. I am converting this NSString to NSMutableAttributedString with following code. text = [[NSMutableAttributedString alloc] initWithData:[cell.lblTitle.text dataUsingEncoding:NSUTF8StringEncoding] …
iPhone
  • 4,092
  • 3
  • 34
  • 58
0
votes
1 answer

need one methods to quantities replace for NSMutableAttributedString same as stringByReplacingOccurrencesOfString for NSString?

Is there a replace method for NSMutableAttributedString similar to stringByReplacingOccurrencesOfString: for NSString? NSString *newString = [myString stringByReplacingOccurrencesOfString:@"," withString:@""]; I need the same method for…
libai
  • 195
  • 1
  • 2
  • 12
0
votes
1 answer

How to use NSSuperscriptAttributeName for OS X

I can change the font and size but I'm stuck with making text a superscript. Here is my working code for font and size: aVerseMutableString = NSMutableAttributedString(string: book.verseText, attributes: [NSFontAttributeName:NSFont(name:…
tazboy
  • 1,685
  • 5
  • 23
  • 39
0
votes
1 answer

Keep the colors of the textView text after appending NSSting

I'm using the next method to change the colors of few words in textView: +(void)changeColorToTextObject : (UITextView *)textView ToColor : (UIColor *)color FromLocation : (int)location length : (int)length { NSMutableAttributedString *text =…
Asi Givati
  • 1,348
  • 1
  • 15
  • 31
0
votes
1 answer

NSMutableAttributedString to know where color is changed on which text

I am doing tagging feature like facebook and I can tag user already. I can show like this. It is done by this code. NSMutableAttributedString * string = [[NSMutableAttributedString alloc]initWithString:self.textView.text]; for (NSString *word in…
Khant Thu Linn
  • 5,905
  • 7
  • 52
  • 120