我正在处理UIWebView
行动Copy
和paste
..我不知道它究竟是如何运作的......
我需要做的是......当我点击链接时,它应该复制URL
并在UiTextField
或Browser bar
它应该能够粘贴...
- (void)actionSheet:(UIActionSheet *)actionSheet
clickedButtonAtIndex:(NSInteger)buttonIndex {
if([title isEqualToString:@"Copy"]){
NSURL *requestedURL = [request URL];
NSString *link = [requestedURL absoluteString];
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = link;
NSLog(@"paste is %@",pasteboard.string); // this does not give me the anything
}
请让我知道我在复制方法中出错的地方,,,以及它是如何粘贴的
答案 0 :(得分:1)
[[UIPasteboard generalPasteboard] containsPasteboardTypes:UIPasteboardTypeListString];
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
if (pasteboard.string != nil) { [self insertText:pasteboard.string]; }