0

用户单击复制后如何从 UIPasteboard 获取图像实际上我可以从 UIPasteboard 获取 Nsdata 但我认为需要将特定编码分配给 uiimageview 我该怎么做?感谢帮助。

4

1 回答 1

0
NSData *data = // however you obtain the data
UIImage *image = [[UIImage alloc] initWithData:data];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[self.view addSubview:imageView];

更好的是:

UIImage *image = [[UIPasteboard generalPasteboard] image];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[self.view addSubview:imageView];
于 2012-07-22T10:49:51.447 回答