UIPasteboard を使用してクリップボード アプリを実装したいと考えています。これは、プレーン テキストとリッチ フォーマット、Web コンテンツをペーストボードにコピーし、TextView または WebView に表示できます。どうやってやるの?
次のコードがあり、プレーンテキストを取得できますが、Web コンテンツをコピーするとどうなりますか?
if ([pasteboard containsPasteboardTypes:[NSArray arrayWithObjects:@"public.utf8-plain-text", @"public.text", nil]]){
if (![_contentList containsObject:pasteboard.string]){
NSLog(@"String representation present: %@", pasteboard.string);
[self addContentList:pasteboard.string];
[pasteboard setValue:@"" forPasteboardType:UIPasteboardNameGeneral];
}
}