uiwebview

Memory leak UIWebView when loading from file instead of URL?

旧时模样 提交于 2019-12-21 22:31:40
问题 I have a UIViewController that contains a UIWebView (OS 3.0). If I load it with file data, as soon as the 'Back Button' is hit and the view is dismissed, I'm seeing EXEC_BAD_ACCESS error with WebCore object releasing 'SharedBuffer' - (void)viewDidLoad { NSString *htmlFile = [[NSBundle mainBundle] pathForResource:fileName ofType:@"html"]; NSData *fileHtmlData = [NSData dataWithContentsOfFile:htmlFile]; [webView loadData:fileHtmlData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:

Load Content in the UIWebView on the Iphone

回眸只為那壹抹淺笑 提交于 2019-12-21 22:10:12
问题 I would like to show Content in the UIWebView, which I have added to the Project. (for example an image) I know how to set a text in the UIWebView, but I would like to add images or a video which I have added to the project. 回答1: Ok, I am assuming you are using loadHTMLString to set the HTML on your UIWebView . So to reference images that are stored in your App bundle, you just need to get the right path to put in your img tag. So get the path string: NSString * imgPath = [[NSBundle

Open specific link in Safari from UIWebView

♀尐吖头ヾ 提交于 2019-12-21 21:49:38
问题 I have a UIWebView which loads a local index.html file. However I have an external link in this html file that I'd like to open in Safari instead of internally in the UIWebView . Opening a link in safari from say a UIButton was simple enough: UIApplication.sharedApplication().openURL(NSURL(string: "http://www.stackoverflow.com")) Opening the Instagram app from a external link also works like a charm. <a href="instagram://media?id=434784289393782000_15903882">instagram://media?id

iPhone - Make a UIWebView subview scrolling to top when user touches the status bar (iOS 4)

巧了我就是萌 提交于 2019-12-21 21:24:35
问题 I have a mainView that contains : a paginated scrollView, a page Control a close button and each page of the scrollView contains a subview that contains a webView. The user can go left to right from pages to pages, and scroll up and down each webView. But... how can I make the currently displayed webView scroll to top when the user touches the status bar ? EDIT : for iOS4 of course. 回答1: [yourPaginatedScrollView setScrollsToTop:NO]; [(UIScrollView *)[yourWebView.subviews objectAtIndex:0]

Unable to Completely Reclaim Memory Usage from UIWebView

ぐ巨炮叔叔 提交于 2019-12-21 20:47:30
问题 I have the following sample code (using ARC) which adds a UIWebView as a subview and subsequently removes it (toggled by a tap gesture on the screen): - (void)toggleWebViewLoading:(UITapGestureRecognizer *)sender { if (webView == nil) { webView = [[UIWebView alloc] initWithFrame:CGRectMake(0.0f, 100.0f, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - 100.0f)]; [webView loadRequest:[[NSURLRequest alloc] initWithURL:[[NSURL alloc] initWithString:@"http://www

Load document directory image into web view [closed]

丶灬走出姿态 提交于 2019-12-21 20:32:56
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I have a an Xcode project with UIWebView . Now I need to load an image from document directory to that webview. How can I acheive this? 回答1: NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory

How to log into web site using uiwebview with swift?

我们两清 提交于 2019-12-21 20:13:02
问题 I want to try to log into a web page using UIWebView in an ios applicaiton. However, I do not know how can I do this. I am showing web site with let url = NSURL(string: "http://m.falalem.com") let request = NSURLRequest(URL: url!) webView.loadRequest(request) I want to log into this page using my username and password parameter. Login Page -> http://m.falalem.com/Login After login page -> http://m.falalem.com/User-Info How can log into this page using uiwebview?? Please help! 回答1: Logging

Check if UIWebview is displaying PDF

别来无恙 提交于 2019-12-21 20:05:56
问题 To be clear, my question is not asking how to display a PDF in a UIWebview. I want to check if the user has navigated to a PDF (.pdf) document from some website or link. That way I can show more options to the user, like saving the PDF or printing it. What's the best way to check if the UIWebView's content is a PDF? 回答1: You can check the MIME type too, for a slightly longer journey: @property (nonatomic, strong) NSString *mime; - (void)connection:(NSURLConnection *)connection

Can I close file descriptors for currently unused UIAppFonts?

强颜欢笑 提交于 2019-12-21 20:05:19
问题 We bundle a lot of fonts with our iOS app, and we put them all in UIAppFonts for faster loading. (We're using them inside UIWebView and it's much faster than using loading files with @font-face ). However this lead me to occasionally get this kind of warning: Mar 13 23:07:16 iPad afcd[2582] <Error>: Max open files: 78 Mar 13 23:07:17 iPad mobile_house_arrest[2584] <Error>: Max open files: 78 Mar 13 23:07:17 iPad mobile_house_arrest[2586] <Error>: Max open files: 78 Mar 13 23:07:17 iPad mobile

How to load local html assets in directories (js, images, css) in a UIWebview? (iOS)

戏子无情 提交于 2019-12-21 19:58:34
问题 Specifically -- how do you get all the assets to load from their respective directories (images/, css/, js/) without changing the content of the original HTML (removing directories)? I am using this code to load index.html into the UIWebview: NSURL *url = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html"]; NSString *html = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil]; NSString *path = [[NSBundle mainBundle] bundlePath]; NSURL *baseURL =