How to get selection text from UIWebView?

前端 未结 1 878
暖寄归人
暖寄归人 2020-12-13 22:42

, Hello, everyone.

I\'m developing my app which has a feature to post article from website.

This is a picture of UIWebview with UIMenuController.

1条回答
  •  [愿得一人]
    2020-12-13 22:58

    Or if you donʾt want to mess with Javascript you can just copy the selection to the pasteboard and then retrieve it by running:

        [[UIApplication sharedApplication] sendAction:@selector(copy:) to:nil from:self forEvent:nil];
        NSString *text =  [UIPasteboard generalPasteboard].string;
    

    0 讨论(0)
提交回复
热议问题