我保存到一个唯一的纸板在这里:
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];对于pastesaved的局部变量,我的错误是“没有选择器的类方法”。
到目前为止我尝试了什么
UIPasteboard *pasteSaved =[[UIPasteboard pasteboardTypes] containsObject:@"myPasteBoard"];
UIPasteboard *pasteSaved = [UIPasteboard pasteboardWithName:@"myPasteboard"];
UIPasteboard *pasteSaved = [UIPasteboard pasteboardWithUniqueName:@"myPasteboard"];
UIPasteboard *pasteSaved = [UIPasteboard: @"myPasteboard"];
UIPasteboard *pasteSaved = [UIPasteboard pasteboardWithUniqueName]; 发布于 2013-10-26 14:54:38
修好了
在使用特定于应用程序的贴图板时,如果您创建或使用create YES or No从它接收到,则需要添加
复制到纸板上
UIPasteboard *pasteboard = [UIPasteboard pasteboardWithName:@"myPasteboard" create:YES];
[pasteboard setPersistent:YES];
//save to unique pasteboard
[pasteboard setString: [NSString stringWithFormat:@"%@",self.myTextFieldHere]];纸板糊
UIPasteboard *pasteboard = [UIPasteboard pasteboardWithName:@"ICPatEditionPasteboard" create:NO];
self.myTextFieldHere.text = [pasteboard string];发布于 2013-10-26 13:08:18
在创建了唯一的pasteboard之后,可以使用addItems:方法将项目粘贴到它:
[pasteboard addItems:@[ @"my_string_for_pasting" ]];或者,
[[UIPasteboard pasteboardWithUniqueName:@"myPasteboard"] addItems:@[ @"my_string_for_pasting"];编辑:
从黑板上阅读:
NSString *copiedString = [[UIPasteboard pasteboardWithUniqueName:@"myPasteboard"] valueForPasteboardType:kUTTypePlainText];https://stackoverflow.com/questions/19606920
复制相似问题