uiwebview

jQuery not loading on the iPhone

旧街凉风 提交于 2019-11-29 09:35:16
I'm trying to use a UIWebView to display content, and jQuery to manipulate that content, but I can't get jQuery to load. Here's the code that I have setting up the UIWebView, setting the baseURL, and loading the content (an HTML file that's in the local bundle): UIWebView *view = [[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; NSString *path = [[NSBundle mainBundle] bundlePath]; NSURL *baseURL = [NSURL fileURLWithPath:path]; NSData *htmlData = [[NSData alloc] initWithContentsOfURL: [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"

iPhone Development: Grabbing selected/highlighted text on UIWebView

本秂侑毒 提交于 2019-11-29 09:28:58
问题 Greetings, Please kindly advice on how possibly I can get the selected text on UIWebVIew . I went on to search on how to deal with selected/highlighted text and found the following: Selection and Menu Management To copy or cut something in a view, that “something” must be selected. It can be a range of text, an image, a URL, a color, or any other representation of data, including custom objects. To implement copy-and-paste behavior in your custom view, you must manage the selection of objects

Can I pass a variable from a UIWebView back to my app using Javascript (or any web technology)?

我是研究僧i 提交于 2019-11-29 09:00:35
I have a UIWebView with a form on it. I would like to get the response from the form sent back to my application so that it can respond accordingly. Is there anyway to do this with javascript or anything? Something like: NSString *formValue1 = [webview stringByEvaluatingJavaScriptFromString:@"document.forms[0].elements[0]"]; 来源: https://stackoverflow.com/questions/4620972/can-i-pass-a-variable-from-a-uiwebview-back-to-my-app-using-javascript-or-any-w

Height of UIWebView minus 44px programmatically?

徘徊边缘 提交于 2019-11-29 08:52:06
Is it possible to set the height of a UIWebView by doing something like this.. [webView.height: currentHeight - 44px]; So essentially, I want to get the height of the UIWebView and then make it 44px shorter from the bottom, programmatically. Save your old frame like this: CGRect oldFrame = WebView.frame; Then set the new frame : CGRect newFrame =CGRectMake(oldFrame.origin.x, oldFrame.origin.y, oldFrame.size.width, oldFrame.size.height-44); [WebView setFrame:newFrame]; Thats it :-) I guess this should be enough. webView.frame = CGRectMake(webView.frame.origin.x, webView.frame.origin.y, webView

Show progress bar until it load the data in UIWebView IOS7

蓝咒 提交于 2019-11-29 08:50:53
Hi in my application i have UIWebView which loads the pdf file using URL its very large file its taking too much time to load. Now i want show the user that like its loading progress until it get load the my pdf once my file loaded its has hide the progress bar, how can I achieve this? My webview code. - (void)viewDidLoad { [super viewDidLoad]; NSString *pdf =@"http://jesusredeems.com/mag/pdf/JRE-2014-03.pdf"; NSURL *url = [NSURL URLWithString:pdf]; NSURLRequest *myRequest = [NSURLRequest requestWithURL:url]; [webview loadRequest:myRequest]; } I'm using the above code to load my pdf , how I

Access the JavaScriptCore engine of a UIWebView

梦想与她 提交于 2019-11-29 08:49:59
问题 I just discovered a new framework available in iOS7: JavaScriptCore. It looks awesome, but how can I access the runtime/context of a UIWebView ? 回答1: There is no official mechanism for this. But there are two approaches I know about to get the JSContext . I probably wouldn't use either in a shipping app. Use KVC to access internal UIWebView properties. Explained in detail in this blog post: http://blog.impathic.com/post/64171814244/true-javascript-uiwebview-integration-in-ios7 JSContext *ctx

UIWebView leaking

可紊 提交于 2019-11-29 08:48:52
I have a class that extends UIViewController and implements the UIWebViewDelegate, like this: @interface TableViewController : UIViewController <UIWebViewDelegate, UIAlertViewDelegate>{ UIWebView *articleWebView; NSString *link; UIActivityIndicatorView *activityIndicator; NSURL * safariUrl; } I'm trying to load a web page into the uiwebview, everything works fine, but i'm getting some leaks (like GeneralBlock-56, GeneralBlock-1024 etc) and i can't find out where they come from. This is what i am doing: - (void)viewDidLoad { [super viewDidLoad]; if (articleWebView){ [articleWebView

PreLoad UIWebView on a not yet displayed UIViewController

纵饮孤独 提交于 2019-11-29 08:46:48
问题 I have an app where on the very last UIViewController there is a UIWebView... the user navigates through the app and at the very end they can transition (modal) to the final UIViewController with a UIWebView... in it's viewDidLoad I have the UIWebView load the page. The problem is it takes about 8 seconds to load this page and that annoys users. How can I load the UIWebView way ahead of time (like when the app is first launched!) if that UIViewController hasn't even been presented yet? 回答1: I

displaying Wiki mobile page in UIWebView within UIPopoverController

廉价感情. 提交于 2019-11-29 08:45:48
I try to open wiki mobile version webpage by a UIWebView within a UIPopoverController. the problem is, not matter how I set my contentSizeForViewInPopover, or just UIWebView frame, or simply set UIWebView.scalesPageToFit = YES. the Wiki mobile version page content size seem to larger than my UIWebView. But if I use it on iPhone, there's no such problem. here's my code for popover controller: //create a UIWebView UIViewController first WikiViewController *addView = [[WikiViewController alloc] init]; addView.contentSizeForViewInPopover = CGSizeMake(320.0, 480.0f); //then create my

UIWebView changes contentSize on iOS 7 after coming back from background

若如初见. 提交于 2019-11-29 07:59:46
问题 The Problem: I have a UIWebView between my UINavigationBar and UITabBar . On iOS 7, when the app enters background and comes back again, it seems as if the contentSize property of the UIWebView changes so that there is a white block above it. After monitoring the contentSize of the UIWebView , when the application enters foreground (I check it by observing the UIApplicationDidBecomeActiveNotification ), it has 49 substracted from it's height. Screenshot (redacted sensitive info): My Settings: