Search code examples
ioskeyboardsmscopy-pasteimessage

How to prevent iOS Messages app from cropping pasted image?


I'm working on an app that lets people copy and paste images. The image is copied like this:

NSString *path =  [[NSBundle mainBundle] pathForResource:@"circle" ofType:@"png"];
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
NSData *data = [NSData dataWithContentsOfFile:path];
[pasteboard setData:data forPasteboardType:@"public.png"];

When then pasting in the Notes app, it works fine. However in the Messages app, it crops the right side of the image. Is there a way to prevent this?

enter image description hereenter image description here


Solution

  • You cannot prevent this, since that was Apple's UI idea. Although you can put a transparent borders into your image so even though Messages.app clips the image the main part of it still be visible.