Questions tagged [nsmutableattributedstring]

357 questions
2
votes
2 answers

Get all attributes of a NSMutableAttributedString into a dictionary

I have a NSMutableAttributedString which contains different attributes for different ranges. I want to read all Ranges with attributes in a dictionary so that I can save all attributes into Core Data and MySql via Api and then again reconstruct the…
Rajat Jain
  • 1,002
  • 1
  • 15
  • 24
2
votes
2 answers

Swift 3 get attributes of textview sub string

I have a textview which contains multiple paragraphs. Each string can be formatted differently, for example some strings are bold and others using italicized fonts. How would I get the attributes for a specific substring and get the attributes for…
mocode10
  • 589
  • 1
  • 6
  • 23
2
votes
1 answer

Why is app hanging only on iOS 10 when the clear button is tapped within a UITextField?

I have a situation where users, only on iOS 10 (10.0 thru 10.3 at the time of this post) encounter a complete app hang when trying to clear text from certain UITextFields by tapping the built-in clear button. This problem does not happen in all…
drshock
  • 2,096
  • 2
  • 15
  • 30
2
votes
1 answer

iOS10.3 system rich text strikethrough can not be displayed

Apple recently released iOS 10.3 version, before the use of NSMutableAttributedString set the strikers do not show the [attributedString addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlineStyleSingle | NSUnderlinePatternSolid)…
chenbo
  • 83
  • 4
2
votes
0 answers

Saving NSMutableAtrributed string with image attachments in core data

I am declaring an NSMutable Attributed String and appending different attributed strings to it. These attributed string may contain images as NSTextattachments. var historyText : NSMutableAttributedString = NSMutableAttributedString(string: "") let…
2
votes
1 answer

Attributed string font color is not working

I am trying to set the font color and its not working for some reason public void ConvertToLinkButton(UIButton btn, String hyperlink) { CTStringAttributes attributesHyperLink = new CTStringAttributes(); attributesHyperLink.UnderlineStyle =…
2
votes
2 answers

iOS Swift - Applying attribute to text view without replacing whole text

I have a TextView in which I select some text and apply attributes to the selected text, successfully. After the update of the NSMutableAttributedString with the desired changes I take my TextView and update its attributed…
Ivan Cantarino
  • 3,058
  • 4
  • 34
  • 73
2
votes
1 answer

Change the image of a selected NSAttributedString

I have this code for creating an Attributed String with an image on a UITextView func setImageOnString(imageName: String) { let fullString = NSMutableAttributedString(attributedString: attributedText) let imageAttachment =…
dmram
  • 125
  • 1
  • 12
2
votes
1 answer

NSMutableAttributedString for adding subscript (superscript) for NSTextView from String

Does there exist a way to append NSMutableAttributedString within normal String? I would like to add text to NSTextView. This particular text (String) has references from Double() variables and I would like to add some upper and bottom indexes…
2
votes
1 answer

Is NSMutableAttributedString with NSTextAttachment creation in cellForItemAtIndexPath a bad idea (performance or design wise)?

I am creating NSMutableAttributedString in the cellForItemAtIndexPath method of my collection view. I am using NSTextAttachment to embed images in the text. Is this a bad idea? Currently the scroll performance seems good but I am not sure if there…
2
votes
1 answer

NSAttributedString with right alignment removes whitespace at the end

I've created a simple chat app where our messages are on the right side (right alignment) and all other messages are on the left side (left alignment). I'm using NSAttributedString because I heavily modify the text with colors etc. Each message is…
2
votes
4 answers

How to show Bold and Italic both to My NSString without ThirdParty Libary in Objective-c

Here is my code which I attempt : NSString *strFirst = [NSString stringWithFormat:@"The App feature is only available to users while at "]; NSString *strAreaName = kAreaName; NSRange boldedRange = [strAreaName…
Mihir Oza
  • 2,768
  • 3
  • 35
  • 61
2
votes
0 answers

UIFont initialiser returns object and crashes the app

My iOS app is crashing on iOS 8.2 and working perfectly on iOS 9 and above. When I checked the crash log, the following function causes the crash (Written in the NSMutableAttributedString extension) func changeFont(font: UIFont, range : NSRange,…
Midhun MP
  • 103,496
  • 31
  • 153
  • 200
2
votes
0 answers

NSMutableAttributedStrring's underline is clipping some characters from bottom

I'm using following code to underline text. NSMutableAttributedString *unserlineText = [[NSMutableAttributedString alloc] initWithString:@"yyyy JJJJ gggggg"]; [unserlineText addAttribute:NSUnderlineStyleAttributeName …
Abid Hussain
  • 1,529
  • 1
  • 15
  • 33
2
votes
3 answers

How to get NSParagraphStyleAttributeName from NSMutableAttributeString?

I create an NSMutableAttributedString with alignment as follows: UIFont * font = [UIFont systemFontOfSize:[UIFont labelFontSize]]; /// Make a copy of the default paragraph style NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle…
user1105951
  • 2,259
  • 2
  • 34
  • 55