iOS 5:UIWebView不从Excel文件复制文本

时间:2013-01-07 19:18:42

标签: ios uiwebview copy xlsx uipasteboard

我使用UIPasteboardChangedNotification来检测用户何时复制突出显示的文本

-(void)viewDidLoad {
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(receiveClipBoardNotification:) 
                                                 name:@"UIPasteboardChangedNotification"
                                               object:nil];
}

这适用于iOS 6,但appPasteBoard.string在iOS 5上返回nil

-(void)receiveClipBoardNotification:(NSNotification *) notification {
    UIPasteboard *appPasteBoard = [UIPasteboard generalPasteboard];
    NSLog(@"%@", appPasteBoard.string);
}

只有xls和xlsx文件才会出现此问题。它适用于其他类型的文件,如pdf,docx,pptx,rtf,pages,key等。

0 个答案:

没有答案