0

ここで独自のペーストボードに保存します:

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];  
4

2 に答える 2

0

独自のペーストボードを作成したら、次のaddItems:メソッドを使用して項目を貼り付けます。

[pasteboard addItems:@[ @"my_string_for_pasting" ]];

あるいは、

[[UIPasteboard pasteboardWithUniqueName:@"myPasteboard"] addItems:@[ @"my_string_for_pasting"];

編集:

ペーストボードから読み取るには:

NSString *copiedString = [[UIPasteboard pasteboardWithUniqueName:@"myPasteboard"] valueForPasteboardType:kUTTypePlainText];
于 2013-10-26T13:08:18.173 に答える