uiwebview

Pdf file in UIWebview with password

安稳与你 提交于 2019-12-02 22:26:07
问题 I would like to specify the password of a PDF file in my request. Is this possible? Currently my code is as following: NSString *nomPdf=_pdffile.name; NSString *path = [[NSBundle mainBundle] pathForResource:nomPdf ofType:@"pdf"]; NSURL *url; NSURLRequest *request; if(path !=nil){ url = [NSURL fileURLWithPath:path]; request = [NSURLRequest requestWithURL:url]; } How can I pass the password string required of the PDF file in this code ? 回答1: Not fully an answer, but to rule out options, it

When can I use a SFSafariViewController, WKWebView, or UIWebView with universal links?

我的未来我决定 提交于 2019-12-02 22:19:21
In the Universal Links section of the iOS App Search Programming Guide , Apple says: If you instantiate a SFSafariViewController, WKWebView, or UIWebView object to handle a universal link, iOS opens your website in Safari instead of opening your app. However, if the user taps a universal link from within an embedded SFSafariViewController, WKWebView, or UIWebView object, iOS opens your app. What does "handle a universal link" mean? Can I not ever open the given URL with an SFSafariViewController , WKWebView , or UIWebView ? Does it only apply during -[UIApplicationDelegate application

iOS UIWebView leaked

眉间皱痕 提交于 2019-12-02 21:27:58
class MyViewController: UIViewController { @IBOutlet weak var webView: UIWebView? override func viewDidLoad() { super.viewDidLoad() let url = NSURL(string: urlString) let request = NSURLRequest(URL: url!) SVProgressHUD.show() webView?.loadRequest(request) webView?.scrollView.header = MJRefreshNormalHeader(refreshingBlock: { [weak self] in if let strongSelf = self { strongSelf.webView?.reload() }}) } override func viewDidDisappear(animated: Bool) { super.viewDidDisappear(animated) SVProgressHUD.dismiss() } } extension MyViewController: UIWebViewDelegate { func webViewDidFinishLoad(webView:

UIWebView search [closed]

孤者浪人 提交于 2019-12-02 21:25:20
Closed . This question is opinion-based. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it can be answered with facts and citations by editing this post . What is the best way to search for a string of text in a UIWebView ? Zakaria I think that the best to proceed is to: Create a javascript function that will find your text Use the stringByEvaluatingJavaScriptFromString: (see here) method to get the javascript code Call the same method to look for the javascript function (put this code in a function that will take the aString argument)

How to open & view view .doc, .docx, .rtf, .ppt, .pptx, .xlsx, .xls file in iphone using UIWebview in Document directory?

こ雲淡風輕ζ 提交于 2019-12-02 21:24:26
Can we open & view .doc, .docx, .rtf, .ppt, .pptx, .xls, .xlsx file in iphone using UIWebview? I am using Document directory to show the file. .doc file is working fine here… but rest of the files' extensions are not working.. if any one has implemented this then please help me... any code snippet or any web link help... thanks in advance... Try this: [self.m_webView loadRequest:[NSMutableURLRequest requestWithURL:[NSURL fileURLWithPath:_m_filePath]cachePolicy:NSURLCacheStorageAllowedInMemoryOnly timeoutInterval:3.0]]; You can change timeoutInterval and cachePolicy, in sometime you have to

intercept copy, paste, define popover in UIWebView

流过昼夜 提交于 2019-12-02 21:23:38
When we highlight a text in UIWebView usually the copy, paste, define.. etc appears. How can I intercept this so that when I choose copy I call some other method/do something else. Is this possible? You can simply override -copy: - (void)copy:(id)sender { // Do something else here return [super copy:sender]; } Edit to answer your comment. Define is a bit trickier, since it's private. However, you could implement your own method. Set up the UIMenuController with your desired items. UIMenuItem *copyItem = [[UIMenuItem alloc] initWithTitle:@"Copy" action:@selector(myCopy:)]; UIMenuItem

Detect single tap in UIWebView, but still support text selection and links

笑着哭i 提交于 2019-12-02 21:20:38
I'm using JavaScript to detect taps in a page I'm showing in a UIWebView, like so: <div id="wrapper"> <a href="http://apple.com">Apple</a> </div> <script> document.getElementById("wrapper").addEventListener('click', function() { document.location = 'internal://tap'; }, false); </script> I'm intercepting links with my web view delegate, and look for "internal://tap". When I get that, I prevent the web view from navigating, and respond to the tap. However doing this I lose the ability to select text. Tapping the link does still work correctly. In fact, just adding an event listener for 'click'

How to add controls beneath a UIWebView

孤人 提交于 2019-12-02 21:12:31
What's the simplest, fastest, or otherwise (objectively) best way to add a couple of controls (e.g. some UIButtons) beneath a UIWebView? To be clear, I'd like to display a regular scrolling UIWebView, but when scrolling reaches the bottom I'd like there to be some UIControls after the web content. I'd rather not fake it with HTML/CSS content that looks like a control; ideally they should be real controls that I can hook up to my view controller as usual. I don't know whether it's easiest to try to do this with one big UIScrollView containing both the UIWebView and the controls (will there be

UIWebView LoadData is not accepting Nil values for textEncodingName and baseURL

淺唱寂寞╮ 提交于 2019-12-02 21:05:23
Till Swift 1.2 version, UIWebView LoadData was accepting nil values, but Swift 2.0 is throwing error "Swift does not conform to protocol NilLateralConvertible". Swift 1.2: Works fine self.webView.loadData(tempData!, MIMEType: "application/pdf", textEncodingName: nil, baseURL: nil) Swift 2.0: Throws error self.webView.loadData(tempData!, MIMEType: "application/pdf", textEncodingName: nil, baseURL: nil) EduTgn75 This works for me: webView.loadData(pdfDownload, MIMEType: "application/pdf", textEncodingName: "", baseURL: NSURL()) zoroloco Swift 3: self.webView.loadData(tempData!, MIMEType:

Tactics to speed up WKWebView rendering of loadHTMLString-d content?

时光怂恿深爱的人放手 提交于 2019-12-02 20:53:08
I've been experimenting with stacking WKWebViews in a UINavigationController as a method of making a hybrid app that's more native than PhoneGap. It broadly works - I hook into decidePolicyForNavigationAction when a WKWebView hits a link, and push a new ViewController with the link it wants. But the page loading is slow. I've done everything I can think of to speed it up - it's using loadHTMLString rather than a request to ensure everything is local - I've even tried stripping out the CSS and JS to see if that speeds it up, but no dice. It still takes at least 500ms for a short, HTML only,