0

我正在处理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
  }

请让我知道我在复制方法中哪里出错了,以及如何粘贴

4

1 回答 1

1

通过此链接:- http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIPasteboard_Class/Reference.html

[[UIPasteboard generalPasteboard] containsPasteboardTypes:UIPasteboardTypeListString];
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; 
if (pasteboard.string != nil) { [self insertText:pasteboard.string]; }
于 2013-02-05T05:21:35.173 回答