uiwebview

Using One or More Formatters with a Page Renderer in iOS

♀尐吖头ヾ 提交于 2019-12-06 13:39:39
Has anyone tried using multiple formatters ( UIViewPrintFormatter , UIMarkupTextPrintFormatter , UISimpleTextPrintFormatter ) with a page renderer ( UIPrintPageRenderer ) to print the content? I'm trying to use two UIMarkupTextPrintFormatters with a UIPrintPageRenderer subclass, but i'm failing to get the print. I'm using MyPrintPageRenderer class from PrintWebView sample code. I've gone through the Apple's documentation but it isn't very helpful, and there is no sample code associated with the description. I've tried a couple of solutions but so far I haven't had any success. Any suggestions?

WKWebView is not loading resources when not presented

☆樱花仙子☆ 提交于 2019-12-06 12:48:46
I am trying to shift my app from UIWebView to WKWebView. When the app starts, my App is downloading an HTML file to the file system. When the download is over, a webview object is created (not presented on screen) and loading the HTML from the device (“file://“). The HTML contains javascript that loads resources from URLs according to certain params. Here is the issues: In UIWebview, all resources are loaded without a problem. In WKWebView there is a weird behavior: If the object (WKWebView) is not presented on screen - resources not being loaded and the general flow of JavaScript is very slow

How do I include CSS resource in programmatically generated HTML for iPhone UIWebView?

梦想与她 提交于 2019-12-06 12:47:23
问题 I am programmatically generating HTML and want to link to a CSS file that I've included in my Resources folder. I am using a baseURL of nil, and my CSS file is at the top level of the project file, but this "link" is definitely not working (ie, the CSS file is clearly not being loaded/found when the UIWebView displays the HTML). Is it possible to do this? Or will I need to put the CSS file on the web somewhere and link to it via a URL? (I can see the advantage of doing this -allowing the app

Can I handle alert inside UIWebViewDelegate?

冷暖自知 提交于 2019-12-06 12:32:30
<script language="javascript"> alert("Hell! UIWebView!"); </script> I can see the alert message inside my UIWebView but can I handle this situation? Update: I'm loading a web-page into my UIWebView: - (void)login { NSString *requestText = [[NSString alloc] initWithFormat: @"%@?user=%@&password=%@", DEFAULT_URL, user.name, user.password]; // YES, I'm using GET request to send password :) NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:requestText]]; [webView loadRequest:request]; } The target page contain a JS. If user name or password is incorrect this JS show alert.

How can I open a WebArchive in a UIWebView?

廉价感情. 提交于 2019-12-06 12:29:21
I'm trying to open a Webarchive stored in a Core Data database. The Core Database was created on a Mac and filled with some Webarchive by using a WebView. Now I want to display these WebArchives in the UIWebView in iOS. The problem is that I don't know how to do that. In a similar post to this ( here ) Digital Robot said, that Webarchives are supported on iOS and I only have to load it from disk with a simple NSURLRequest into the UIWebView. The problem here is, that it doesn't get loaded - I only get a blank UIWebView. Here is the code i tried : NSURL *url = [NSURL fileURLWithPath:[

UIWebview size limit

ⅰ亾dé卋堺 提交于 2019-12-06 12:09:38
Everytime I load a html file that is larger than 2MB my app crashes. Is there a limit to how big a web page can be? How can I not crash my app (partial loading?) Lou Franco When you load 2MB of HTML, the UIWebView has to consume a lot of memory to create a DOM and all of the controls/graphics/etc. to actually show the page. The limit is not the HTML size, but the resulting amount of memory that is needed to display it. Run it in the simulator with the Activity Monitor to see memory consumption Xcode Instruments: peak RAM of iPhone apps running in Simulator? You'll need to break down your pages

Displaying HTML in iPhone app

时光毁灭记忆、已成空白 提交于 2019-12-06 11:45:01
How to open url in textview iphone?? Is it possible to show data with links , photos and all html entities ??? Alex Nazarsky It's not possible with UITextView control. Use UIWebView or make your own custom control. You can use UIWebView to load a static contain from files; html, photo, css, javascript. NSString *path = [[NSBundle mainBundle] bundlePath]; NSURL *baseURL = [NSURL fileURLWithPath:path]; NSString *filePath = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]; NSString *htmlString = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];

UIWebView: open some links in Safari, some within the view

心已入冬 提交于 2019-12-06 11:40:00
问题 My app features content that (for text formatting reasons) is presented in an UIWebView. Within the content there are links, some of which should open their target in mobile Safari, while others should navigate within the content. So far, I've catched the link requests using a UIWebView delegate. In my implementation of -(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType I'd check the requests URL using

iPhone SDK- Launch youtube application from within my application

泄露秘密 提交于 2019-12-06 11:38:56
I am developing an app that use UIWebView to display a list of videos from youtube. For playing the videos I use the youtube embed feature and it open the youtube application when the user clicks the video thumbnail - works great. I want the same functionality to be executed when I click a "Watch Now" button that will be located near the youtube thumbnail on my web view but when I try to use "href" to the youtube video it opens the "youtube play page" and not the youtube iPhone application like in the embed way... Any ideas? Netanel. I've created a test project with following code executed: [

Setting UIScreen's mode / resolution

丶灬走出姿态 提交于 2019-12-06 11:36:19
问题 I have to set the external UIScreen's mode to run with the resolution 1024x768. First I search if the screen supports this resolution: if ([[UIScreen screens] count] > 1){ CGSize size1024; size1024.height = 0; size1024.width = 0; UIScreenMode *screenMode1024 = nil; UIScreen *secondScreen = [[UIScreen screens] objectAtIndex:1]; for(int i = 0; i < [[secondScreen availableModes] count]; i++) { UIScreenMode *current = [[[[UIScreen screens] objectAtIndex:1] availableModes] objectAtIndex: i]; if