Tag: uipasteboard

你如何复制一个string到剪贴板(粘贴板)在iOS?

如何将一个string复制到iOS中的剪贴板上? 我在文档中search“剪贴板”,没有点击。

从独特的PasteBoard(特定于应用程序的粘贴板)

进出口保存到一个独特的粘贴板: UIPasteboard *pasteboard = [UIPasteboard pasteboardWithName:@"myPasteboard" create:YES]; [pasteboard setPersistent:YES]; //save to unique pasteboard [pasteboard setString: [NSString stringWithFormat:@"%@",self.myTextFieldHere]]; 试图在这里读出来: UIPasteboard *pasteSaved = [UIPasteboard pasteboardWithName:@"myPasteboard"]; _myTextFieldHere.text = [pasteSaved string]; 我的错误是“没有select器的类方法”我的本地variablespastesaved 到目前为止,还没有尝试过 UIPasteboard *pasteSaved =[[UIPasteboard pasteboardTypes] containsObject:@"myPasteBoard"]; UIPasteboard *pasteSaved = [UIPasteboard pasteboardWithName:@"myPasteboard"]; UIPasteboard *pasteSaved = [UIPasteboard pasteboardWithUniqueName:@"myPasteboard"]; UIPasteboard *pasteSaved = [UIPasteboard: @"myPasteboard"]; UIPasteboard *pasteSaved = [UIPasteboard pasteboardWithUniqueName];

UIPasteboard安全

我需要将信息存储在打开应用程序时总是需要阅读的应用程序中。 但我不希望用户复制/转储/或编辑它。 所以问题是:“UIPasteboard能解决这个问题吗? 这是安全吗? 如果不是,还有什么是适合使用的。 非常感谢你。 编辑:有没有其他解决scheme可以解决“删除并重新安装应用程序?

UIPastboard不适用于iOS 7?

我正在一个iOS应用程序中,我必须在两个应用程序之间共享一些数据,我正在使用UIPastboard和数据在7.0以下的iOS中成功共享,但不在iOS 7中工作。下面是我正在使用的代码: //编写代码….用于应用程序“A” NSString * name = @"peter"; NSNumber *age = [NSNumber numberWithInteger:[@"33" integerValue]]; NSMutableDictionary * dict =[[NSMutableDictionary alloc]init]; [dict setObject:name forKey:@"name"]; [dict setObject:age forKey:@"age"]; UIPasteboard * pb = [UIPasteboard pasteboardWithName:@"mypasteboard" create:YES]; [pb setPersistent:YES]; [pb setData:[NSKeyedArchiver archivedDataWithRootObject:dict] forPasteboardType:@"mydata"]; //读取代码…..用于应用程序“B” UIPasteboard * pb=[UIPasteboard pasteboardWithName:@"mypasteboard" create:NO]; NSData * data=[[NSData alloc] init]; data=[pb valueForPasteboardType:@"mydata"]; NSDictionary * dict; if […]

为什么UIPasteboard忽略我使用的图像方向?

我正在拍摄相机的图像,并将其旋转到新的方向,然后粘贴到一般的纸板上。 但是,无论我传入方向,粘贴板命令后来粘贴的方向都像是UIImageOrientationUp一样。 CGImageRef croppedImageRef = CGImageCreateWithImageInRect([self CGImage], CGRectMake(rect.origin.y, [self size].width – rect.origin.x – rect.size.width, rect.size.height, rect.size.width)); UIImage *croppedImage = [UIImage imageWithCGImage:croppedImageRef scale:self.scale orientation:orientation]; CGImageRelease(croppedImageRef); [[UIPasteboard generalPasteboard] setImage:croppedImage]; 我使用类似的代码成功地从相机旋转图像,并将其插入到相册中: CGImageRef croppedImageRef = CGImageCreateWithImageInRect([self CGImage], CGRectMake(rect.origin.y, [self size].width – rect.origin.x – rect.size.width, rect.size.height, rect.size.width)); UIImage *croppedImage = [UIImage imageWithCGImage:croppedImageRef scale:self.scale orientation:orientation]; CGImageRelease(croppedImageRef); [self writeUIImageToCameraRoll:croppedImage withOrientation:orientation]; 我怎么不能像我想要的纸板一样旋转图像? 是否使用EXIF方向进行粘贴操作? […]

不使用比例尺的粘贴板UIImage

我正在构build一个自定义键盘,无法将图像添加到粘贴板,并在粘贴的图像中保持适当的比例和分辨率。 让我先从键盘的屏幕截图来说明我的麻烦: 因此,键盘左上方的脸部图片只是一个UIButton,原始的照片设置为背景。 当按下button时,图像被调整为以下function: func imageResize(image:UIImage, size:CGSize)-> UIImage { let scale = UIScreen.mainScreen().scale UIGraphicsBeginImageContextWithOptions(size, false, scale) var context = UIGraphicsGetCurrentContext() CGContextSetInterpolationQuality(context, kCGInterpolationHigh) image.drawInRect(CGRect(origin: CGPointZero, size: size)) let scaledImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return scaledImage } 这个函数创build一个与UIButton具有相同尺寸的UIImage,并以适当的比例来反映设备的屏幕分辨率。 为了validation该function是否正确,我添加了一个用缩放图像填充的UIImageView。 缩放的图像是在键盘中心附近看起来错位的图像。 我用这个函数添加了UIImageView: func addImageToBottomRight(image: UIImage) { var tempImgView = UIImageView(image: image) self.view.addSubview(tempImgView) tempImgView.frame.offset(dx: 100.0, dy: 50.0) } 我已经尝试了几种不同的方法来将图像添加到粘贴板上,但是都似乎忽略了图像的比例,并显示了两倍的大小,而不是以更高的分辨率显示图像: let […]

要使用UIPasteBoard将gif粘贴到邮件窗口中

我想要显示一个gif,所以我做的是我分裂我的gif,并显示在一个animationUIImageView使用此链接。 http://iphonenativeapp.blogspot.com/2011/03/how-to-show-animation-in-iphoneipad-app.html 现在,我想让用户复制该gif并将其粘贴到邮件应用程序中。 如果我使用包含gif所有分割图像的数组,则将4-5张图像粘贴到邮件应用程序中。 请帮我贴上gif。 谢谢!

UIPasteboardstring从Today扩展中返回null

看来,在iOS 9 / Xcode 7testing版5,我无法访问 [[UIPasteboard generalPasteboard] string]; 从我今天的小部件扩展每次不pipe内容,它返回(NULL)。 我查看了发行说明,并没有看到任何关于此的内容。 有任何想法吗?

确定是否成功复制到UIPasteboard

我正在以编程方式将图像复制到UIPasteboard,并且要确定副本是否成功。 具体来说,我在iOS 8上创build了一个自定义键盘,其中一些键将图像复制到粘贴板,供用户粘贴到文本框中。 UIPasteboard *pasteBoard = [UIPasteboard generalPasteboard]; [pasteBoard setImage:[UIImage imageNamed:anImage]]; 要做到这一点,用户必须允许键盘上的“完全访问”。 所以我必须要有一种方法来确定Full Access是否打开(不知道如何检查这个),或者确定复制到粘贴板是否成功。 如果完全访问没有打开,我必须提醒用户打开它以使键盘正常工作。 当复制失败时(由于完全访问被closures),我从UIPasteboard获得日志消息: UIPasteboard – failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support 有没有在运行时捕捉这个? 任何build议如何实现这一点,将不胜感激!

iOS – UIPasteboard不能在应用外工作

我认为这是比我的应用程序更多的SDK漏洞,但最近我一直在尝试使用UIPasteboard从我的应用程序中复制string,它适用于在应用程序内部粘贴的地方。 当我通过按主页button或类似的东西跳转到另一个应用程序时,我根本没有select粘贴复制的内容。 UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; [pasteboard setString: @"blah" ]; NSLog(@"%@", pasteboard.string); 在这种情况下它会打印出“blah”,每当我快速触摸一个文本框时,就会显示粘贴选项。 但是,如果我去Safari浏览器,笔记或邮件它不显示我的选项。 另外,如果我从邮件中复制东西,去我的应用程序,我不会看到粘贴选项以及…