2013-02-05 108 views
0

我處理UIWebView行動Copypaste ..我不知道它究竟是如何工作的.. 我需要什麼,我做的是...當我在鏈接挖掘它應該複製URLUiTextFieldBrowser bar它應該能夠粘貼...UIWebView的複製粘貼

什麼我做的是:

- (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 
    } 

請讓我知道我在複製方法腳麻,,它被粘貼如何

回答

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]; } 
+0

ya謝謝你!讓我試試這個 – Christien

+0

謝謝..我在我的代碼中犯了錯誤...如果你可以幫助我在這個問題然後,,, http://stackoverflow.com/questions/14686406/uilongpressgesturerecognizer-not-working/14687134#14687134 – Christien