Questions tagged [nstextattachment]

NSTextAttachment class is used for embedding images into attributed strings(NSAttributedString). Supported by iOS 7.0+, masOS 10.10+, tvOS 9.0+ and watchOS 2.0+

NSTextAttachmentobjects contain either anNSData object or anFileWrapper object, which in turn holds the contents of the attached file.

Docs: NSTextAttachment reference

135 questions
0
votes
1 answer

Delete / Remove NSTextAttachment from UITextView

I have a UITextView that will have a mixture of images (as NSTextAttachment) and character strings. The UITextView is NOT selectable, so I can use: - (BOOL)textView:(UITextView *)textView shouldInteractWithTextAttachment:(NSTextAttachment…
Gukki5
  • 459
  • 4
  • 20
0
votes
1 answer

Search word in attributedString from backword and get range Objective-C

How do I search the space "" (space) in an attributedString from the end of the string backwards and then get the range of that space? problem : As you can see jumps is in two line which is not correct. The logic i want to implement is like that,…
sanjeet
  • 1,503
  • 15
  • 36
0
votes
0 answers

ReplaceCharactersInRange of NSAttributedString

I want to replace a substring (e.g. @"replaceString") of an NSAttributedString (which contains NSTextAttachments in it) with another NSAttributedString. I have tried to work with the mutableString of NSMutableAttributedString, but result is omitting…
0
votes
0 answers

ios UITextView repeat shown NSTextAttachment in markedText with Chinese input. [ios7 5c]

I want to insert a 'text image' into the textView using the NSTextAttachment. It's fine when the text is English, but something wrong when the text is Chinese. the code: - (IBAction)insertAt:(id)sender { UIColor *color = [UIColor redColor]; UIFont…
0924wuyr
  • 13
  • 3
0
votes
1 answer

Text gets reset after inserting an image in an NSAttributedString

I have a UITextView and I am inserting images into using NSTextAttachment. The problem is that when the user moves the cursor after the image and begins to type text, instead of using the font used everywhere else in the UITextView, it resets to a…
Senseful
  • 73,679
  • 56
  • 267
  • 405
0
votes
1 answer

Interactable UITextField above NSTextAttachment

I previously developed a Mac app using NSTextAttachmentCell, and applying a NSTextfield to it, so that a textfield would appear above the inserted image. Note that this NSTextAttachmentCell is inserted into an NSTextView. Now, on iOS, I have tried…
Naoto Ida
  • 1,195
  • 11
  • 27
0
votes
3 answers

How can I Add second NSTextAttachement image in uilabel?

I wanted to add image in UILabel along with text. However I used NSTextAttachment to add image at the end of UILabel text. I have subclass it to to fit the size of image to my text. Now I want to add one more image in the beginning of the text, we…
Parth Pandya
  • 1,422
  • 1
  • 18
  • 30
0
votes
2 answers

Change NSTextAttachment image don't work immediately even in main queue

I use NSTextAttachment to Display a placeholder image . when click this image , I want to show another image. I do this in UItextView delegate method : -(BOOL)textView:(UITextView *)textView shouldInteractWithTextAttachment:(NSTextAttachment…
james
  • 615
  • 4
  • 24
0
votes
1 answer

NSTextAttachment cover the text when use textkit

I want to insert image in UITextView, so I use textkit and NSTextAttachment. But when I insert image, the image display above the content in UITextView, the effect like below: and the code is like this: // // TextKitView.m // TextKit // // …
lixiaoyu
  • 380
  • 4
  • 18
0
votes
1 answer

export image from attributed text in Swift

I have an attributed text which contains an NSTextAttachment which I insert earlier. Now I need to extract that image and any text to individual variables to save them separately. But I get an error which provides me with no more information other…
snksnk
  • 1,372
  • 2
  • 18
  • 37
0
votes
1 answer

Showing Clickable URLs and icon in UILabel

I am using TTTAttributedLabel for URLs and phone number in my app. Every thing is working fine but the problem is that now I need to show icon in the UILabel. Before I am using given below code. But due to use of TTTAttributedLabel now…
Iqbal Khan
  • 4,416
  • 6
  • 41
  • 78
0
votes
1 answer

NSAttributeString Height seems align wrong when use both image and text

I have a uilabel in tableviewcell ,and the label use NSAttributeString to support both image and text. But I found when the label contains image or text only , the height of label is correct ,but when label contains image and text both ,the height…
ximmyxiao
  • 2,130
  • 3
  • 17
  • 28
0
votes
1 answer

ios7 custom interaction with nstextattachment in uilabel

I have an NSTextAttachment with an image in a UILabel and I would like to perform a custom behaviour when clicking on this attachment. UITextViewDelegate provides an handy method textView:shouldInteractWithTextAttachment:inRange: But it can only be…
ram
  • 21
  • 4
0
votes
1 answer

ASP VBScript code gives "800a0005 Runtime error Invalid Procedure Call"

The ASP code getting the below error while writing text to file. Microsoft VBScript runtime error '800a0005' Invalid Procedure call or argument The Line in which i get the above error is below, oFile.Write Chr(AscB(MidB(FileData,nIndex,1))) The…
Sarath Kumar
  • 1
  • 1
  • 2
-1
votes
1 answer

Inserting multiple images in UILabel

I know how to insert a UIImage inside a UILabel but I am not sure how insert more than one image as appending the new image to the attributed string will always discard the previous attached image. Is there a way to insert multiple images or maybe…
Tarek
  • 651
  • 5
  • 24
1 2 3
8
9