你好~我有一个问题。^^
如何在 UIWebView(或 UITextView)上获取“选定文本”?
我想复制“选定的文本”而不复制/粘贴弹出视图。
1)我删除了...复制/粘贴视图。(成功了~)
UIMenuController *theMenu = [UIMenuController sharedMenuController];
[theMenu setMenuVisible:NO];
[theMenu update];
2.强制复制“选定文本”(失败)
复制控制器.h -------------
@interface copyController : UIViewController <UIWebViewDelegate>
{
UIWebView *WebView;
}
复制控制器.m -------------
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
// ----------> here !!!!!
// I'd like to forced copy "selected text" without copy/paste popup-view
// ** How can i get selected text ???**
return [super canPerformAction:action withSender:sender];
}
- (void)copy:(id)sender
{
UIPasteboard *board = [UIPasteboard generalPasteboard];
NSLog(@"SENDER : copied : %@",board.string);
}
如何在 canPerformAction 中复制文本。?
我想复制“选定文本”的原因只是为了通过更改颜色和字体来装饰文本。
谢谢你~