Reputation: 17892
When I add an image and a string to the pasteboard I get a mysterious line break at the start of my text?
NSMutableDictionary *photo = [NSMutableDictionary dictionary];
NSMutableDictionary *text = [NSMutableDictionary dictionary];
NSData* imageData = UIImagePNGRepresentation(theImage.image);
[photo setValue:imageData forKey:(NSString*)kUTTypePNG];
[text setValue:theText.text forKey:(NSString *)kUTTypeUTF8PlainText];
[[UIPasteboard generalPasteboard] setItems:[NSArray arrayWithObjects:photo, text, nil]];
It puts the photo at the top and then it puts a line break and then the text. If I try to send the image and text in an iMessage the image separates anyways and I end up with the text in a bubble with a silly looking line-break infront of it.
If I just copy the text without the photo it does not add a mysterious line-break.
[[UIPasteboard generalPasteboard] setItems:[NSArray arrayWithObjects:text, nil]];
Does anyone know how to fix this?
If not, can anyone think of some nice workaround? Are there any unicode characters that will reverse a line-break? etc?
Upvotes: 5
Views: 835