博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
IOS读写剪切板 UIPasteboard (备忘)
阅读量:6553 次
发布时间:2019-06-24

本文共 430 字,大约阅读时间需要 1 分钟。

hot3.png

写剪切板

UIPasteboard* slotPB = [UIPasteboard pasteboardWithName:@"a.com" create:YES];

 [slotPB setData:[NSKeyedArchiver archivedDataWithRootObject:@"hello"] forPasteboardType:@"test"];

读剪切版

UIPasteboard* slotPB = [UIPasteboard pasteboardWithName:@"a.com"  create:YES];

NSString *txt = [NSKeyedUnarchiver unarchiveObjectWithData:[slotPB dataForPasteboardType:@"test"]];

 NSLog(@"%@", txt);

转载于:https://my.oschina.net/ahuaahua/blog/123394

你可能感兴趣的文章