IOS讀寫剪切板 UIPasteboard (備忘)

寫剪切板 spa

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

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

讀剪切版 test

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

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

 NSLog(@"%@", txt); arc

相關文章
相關標籤/搜索