UIPasteboard is used to store different types of data into iOS clipboard. We can store data of NSString, NSArray, UIImage, NSUrl, NSData into it and can retrieve the data into that particular format too.
Questions tagged [uipasteboard]
263 questions
259
votes
7 answers
How to copy text to clipboard/pasteboard with Swift
I'm looking for a clean example of how to copy text to iOS clipboard that can then be used/pasted in other apps.
The benefit of this function is that the text can be copied quickly, without the standard text highlighting functions of the traditional…

Garry Law
- 2,936
- 2
- 16
- 14
48
votes
5 answers
Copy functionality in iOS by using UIPasteboard
NSString *copyStringverse = [[NSString alloc] initWithFormat:@"%@",[textview.text]];
UIPasteboard *pb = [UIPasteboard generalPasteboard];
[pb setString:copyStringverse];
I'm using above code for copying contents in textview, but I want to copy…

stackiphone
- 1,245
- 3
- 19
- 41
16
votes
3 answers
How to copy UIImage data to clipboard/UIPasteboard? And how do I test it?
I tried to use the following code to copy the Image data to UIPasteboard on click of the Copy item in the menu.
UIPasteboard *gpBoard = [UIPasteboard generalPasteboard];
[[gpBoard setData:UIImageJPEGRepresentation(imgView.image, 1.0)…

pradeepa
- 4,104
- 5
- 31
- 41
13
votes
1 answer
Receiving UIPasteboard (generalPasteboard) notification while in the background
In there a way to do this? I register my object for UIPasteboardChangedNotification at launch time, but when sending it to the background and opening (for instance) Safari and copying some text, my handler never gets called.
(I'm using just the…

NuBie
- 151
- 1
- 5
12
votes
2 answers
Copy Image with UIPasteBoard (Swift)
I recently saw this project in which a user can tap on a GIF from a custom keyboard and they would see a "copied" toolip appear. I have one question:
How does one reproduce this tooltip in the products GIF-Tutorial?
Could anyone give me some…

Guled
- 659
- 1
- 5
- 18
12
votes
1 answer
How to write custom metadata to PNG images in iOS
My application should be able to write custom metadata entries to PNG images for export to the UIPasteboard.
By piecing together various posts on the subject, I've been able to come up with the class given below as source.
Triggering the copyPressed…

Rich Apodaca
- 28,316
- 16
- 103
- 129
12
votes
5 answers
Copy NSAttributedString in UIPasteBoard
How do you copy an NSAttributedString in the pasteboard, to allow the user to paste, or to paste programmatically (with - (void)paste:(id)sender, from UIResponderStandardEditActions protocol).
I tried:
UIPasteboard *pasteBoard = [UIPasteboard…

Guillaume
- 21,685
- 6
- 63
- 95
10
votes
2 answers
Copy and Paste on iPhone with multiple data representations
I encountered some issues when trying to put more than one data representation onto the pasteboard on iPhone 3.0.
What I'm trying to do is put a data representation and a string representation onto the pasteboard. The data is my own data type and I…

Markus Müller-Simhofer
- 3,391
- 1
- 28
- 32
9
votes
1 answer
Copying .gif images to clipboard using UIPasteboard through code [iOS]
I want to copy .gif images to clipboard, so as user can paste that gif images from application to mails, etc...
I have tried :-
NSData *data = [NSData dataWithContentsOfURL:[NSURL…

P.J
- 6,547
- 9
- 44
- 74
8
votes
2 answers
MFMessageComposeViewController not displaying camera icon
When I bring up a "New Message" manually I will see a camera icon to the left of the text edit area. When I use the MFMessageComposeViewController it will not display this icon which means you cannot insert images. I know this can be done because…

whatchamacallit
- 238
- 1
- 7
8
votes
5 answers
iOS - UIPasteboard not working outside app
I think this is more of an SDK flaw than my apps' but recently I've been trying to use UIPasteboard to copy strings from my app and it works fine to pasting somewhere when I'm inside the app.
When I jump to another app by either pressing the home…

Thiago Peres
- 824
- 1
- 11
- 16
8
votes
1 answer
Copying HTML using UIPasteBoard and pasting into Gmail
I am trying to find a way to use UIPasteBoard to copy a HTML string into pasteboard, and be able to paste it into different mail clients on iOS.
I tried two accepted answers from StackOverflow: https://stackoverflow.com/a/6566850/1249958 and…

halilb
- 4,055
- 1
- 23
- 31
8
votes
3 answers
copy video to uipasteboard
I have successfully able to copy or add the image to pasteboard by using following code:
if (ver_float < 6.0)
{
UIPasteboard *pasteboard;
pasteboard = [UIPasteboard generalPasteboard];
NSString *filePath =pathToImage;
[pasteboard…

Vishal
- 8,246
- 6
- 37
- 52
8
votes
3 answers
iOS SDK getting clipboard text on application load
I would like to get the text copied to clipboard when application launching.
I can use following text to get the available text from clipboard. But I need to use this value in a different viewcontroller. How can I pass this value to my…

Rukshan
- 7,902
- 6
- 43
- 61
7
votes
3 answers
iOS - detect when user copy to clipboard - [UIPasteboard generalPasteboard]
quick easy question
while using a WebView with some text in it - the user can select a snippet of text from it
and press a UIButton which I created - running the following action:
-(IBAction)copyToClip
{
NSString *copyClip = [UIPasteboard…

chewy
- 8,207
- 6
- 42
- 70