uiwebview

access camera from uiwebview?

风格不统一 提交于 2019-12-17 15:53:12
问题 Is it possible to access iphone's camera from uiwebview? I know phonegap does it, but how to make it work without phonegap? Thanks. 回答1: You can implement the UIWebView Delegate and intercept any attempted page load. By setting a custom url, you can pass a message to Objective C, that can launch the camera. To send data back to the web weiw you can initiate a new load (as I do in my example), or pass in some javascript using another method on UIWebView. Here is a working example, I just wrote

iOS download and save HTML file

ぐ巨炮叔叔 提交于 2019-12-17 15:44:10
问题 I am trying to download a webpage (html) then display the local html that has been download in a UIWebView. This is what I have tried - NSString *stringURL = @"url to file"; NSURL *url = [NSURL URLWithString:stringURL]; NSData *urlData = [NSData dataWithContentsOfURL:url]; if ( urlData ) { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *filePath = [NSString stringWithFormat:@"%@

Rendering PDF in UIWebView iOS 8, causes a black border around PDF

妖精的绣舞 提交于 2019-12-17 15:34:25
问题 In iOS 8, when rendering a .PDF into a UIWebview there is a black border and background around the PDF displayed (not the whole background view). Note this is not the UIWebview background which is set to: myWebView.opaque = NO; myWebView.backgroundColor = [UIColor clearColor]; This is not present in < iOS8, (no black bordering coloured background around the .PDF) Anyone else experienced this who could shed some light on this? Im loading my PDF into the Web view like so.. - (void

UIWebView random crash at [UIViewAnimationState release]: message sent to deallocated instance

久未见 提交于 2019-12-17 15:25:33
问题 I'm having a random UIWebView crash using iOS8.1 and UIWebView , using an iPhone5 . In my tests the crash doesn't appear on iOS7 . I've created this github repository to reproduce the crash: https://github.com/crarau/WebViewCrash Basically I'm adding a UIWebView and loading www.amazon.com Randomly the app is crashing on the WebThread with EXC_ARM_BREAKPOINT After enabling Zombie tracking on the console there is this message: [UIViewAnimationState release]: message sent to deallocated instance

Convert UIWebview contents to a UIImage when the webview is larger than the screen

牧云@^-^@ 提交于 2019-12-17 10:35:18
问题 Very similar to this question (and also this answer), I'm trying to make an UIImage out from a webview. So far I'm using the code suggested in the answer, specifically: UIGraphicsBeginImageContext(webview.bounds.size); [webview.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); However, when the contents of the webview are larger than the screen, the resulting images are not complete and have missing

how to cache a whole web page with images in iOS

人走茶凉 提交于 2019-12-17 10:33:42
问题 I am working on a image-text mixture page on iOS. I know it is possible for me to use UIWebView to achieve the goal. But the problem is, user may need to read the page offline. For the text part, I can save the html to the disk and load it in the offline mode. But how about images? Is it possible to cache the images to the disk and the UIWebView can still be able to display them? Thank you! 回答1: The ASIHTTPRequest project has a class called ASIWebPageRequest which is designed to do exactly

UIWebView dones't resize correctly when orientation change?

瘦欲@ 提交于 2019-12-17 10:24:01
问题 I have add a webview,a titleLabel and a coverflowView on a viewcontroller's view as its subviews, I want it to change size when the orientation change. I have change the webview's frame in this method: - (void)willRotateToInterfaceOrientation: (UIInterfaceOrientation)toInterfaceOrientation duration: (NSTimeInterval)duration its content did resize when rotate iPad from orientationLandscape to orientationPortrait or from orientationPortrait to orientationLandscape if I start the application

UIWebView didFinishLoading fires multiple times

徘徊边缘 提交于 2019-12-17 10:23:32
问题 I have some code that needs to run after the a UIWebView finishes loading a document. For that I've set the UIWebView 's delegate to my controller, and implemented the webViewDidFinishLoading method. This gets called multiple times, depending on the type of page to load. I'm not sure if it's because of ajax requests, requests for images, or maybe even iframes. Is there a way to tell that the main request has finished, meaning the HTML is completely loaded? Or perhaps delay my code from firing

UIWebView - Enabling Action Sheets on <img> tags

雨燕双飞 提交于 2019-12-17 10:15:22
问题 Is it just me or has the action sheet on <img> tags been disabled in UIWebView? In Safari, e.g, when you want to save an image locally, you touch and hold on the image to get an action sheet shown. But it's not working in my custom UIWebView. I mean, it is still working for <a> tags, i.e, when I touch and hold on html links, an action sheet shows up. But not for the <img> tags. I've tried things like putting img { -webkit-touch-callout: inherit; } in css, which didn't work. On the other hand,

UIWebView and Safari comparison

帅比萌擦擦* 提交于 2019-12-17 09:43:43
问题 Does UIWebView use the same JavaScript engine as Mobile Safari? Also, does UIWebView support all HTML5 features like Mobile Safari does? I am specifically concerned about Web SQL and Web Workers If I have an app which is written purely in HTML and JS, should I wrap it up in a UIWebView or should I have it open in Mobile Safari Are pure HTML and JS apps accepted on the Apple store? 回答1: Does UIWebView use the same JavaScript engine as Mobile Safari? UIWebView does not have the Nitro Javascript