uiwebview

Swift: How to change only <img> or image sizes in webView

放肆的年华 提交于 2019-12-05 15:44:54
I am getting HTML from a server and display it in a UIWebView.The "Scale Page to fit" option is not selected because of the requirement. The UIWebView width is equal to the screen width and height varies according to the content. The image tags in HTML contains some inline styling which are creating some problem in the view of webView. Screenshots are attached in 1st Image you can see the image is small because of small size set to it's inline styling. But 2nd one has larger image, so the image goes out of bound. Is there any way to control the width of the image to equal to the screen width/

Help Using Javascript Code in a UIWebView

情到浓时终转凉″ 提交于 2019-12-05 15:38:27
I would like to run the following code in a webView, so that the content is editable: javascript: document.body.contentEditable ='true'; document.designMode='on'; void 0 So far I have got as far as trying this: - (void)webViewDidFinishLoad:(UIWebView *)webViews { NSString *string = @"javascript: document.body.contentEditable ='true'; document.designMode='on'; void 0"; [webView stringByEvaluatingJavaScriptFromString:string]; [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:string]]]; NSLog(@"finished load"); } If you could tell me how to get this working that would be

UIWebView get HTML Source

為{幸葍}努か 提交于 2019-12-05 15:19:46
I am trying to get the HTML source of a UIWebView without re-downloading it again (a.k.a. do another download, such as [NSData dataWithContentsOfURL:(NSURL*)URL] or launching an NSURLRequest. Browsing the UIWebView header and documentation, there seems to be no way of accessing the current loaded NSData of the source. Am I missing something ? The inverse should do what you want. That is, load the URL into an NSData object and then load the UIWebView from that object using – loadData:MIMEType:textEncodingName:baseURL: UIWebView can execute javascript code, so this can work it out. NSString

scalesPageToFit broken on UIWebView after keyboard is shown?

吃可爱长大的小学妹 提交于 2019-12-05 14:54:45
I have this meta tag: <meta name="viewport" content="width=768, minimum-scale=1.0, user-scalable=no" /> And I am setting scalesPageToFit: webView.scalesPageToFit = YES; At first this works correctly. When I go from portrait to landscape it zooms in so the width of the device is always 768px. I can go back and forth with no issues (portrait <-> landscape). As soon as I activate the virtual keyboard, whether it be through a contentEditable or text area, it stops working completely, even after I dismiss the keyboard. Is this a bug in the UIWebView? Is there anything else I need to do to make this

UIWebview scrollview changes contentsize for no reason

时间秒杀一切 提交于 2019-12-05 14:29:28
I have a uiviewcontroller which loads a uiwebview. When the uiviewcontroller loads the uiwebview everything is done correctly. But when one navigates away and returns back and the uiwebview is not loaded, it is displayed differently. The uiwebview scrollview's contentsize height changes by 64px, it gets higher. When it is loaded for the first it looks like this When one returns back to the view, this is what happens I hope I was able to make my problem understandable. If more details are necessary, I am able to give more. Thank you I had a similar problem, try this code in your viewDidLoad

Does iPhone/iPad UIWebView need to be active view to render?

浪尽此生 提交于 2019-12-05 14:19:46
I need to render a web page offscreen to a bitmap, then show the bitmap to the user. Can this be done with simple code on the main thread like this: NSString *urlAddress = @"http://www.google.com"; NSURL *url = [NSURL URLWithString:urlAddress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [offscreenWebView loadRequest:requestObj]; Or do I need to attach the UIWebView to an active view? In Android, the web view seems not to render unless it is part of an active view. So to do this task in Android, I need to create a view hierarchy, create an active view for the web renderer,

Youtube video in landscape mode within a UIWebView

北城余情 提交于 2019-12-05 13:58:45
问题 My application was not made ​​for the landscape. But when I open my YouTube channel in a UIWebView and a user launches a video , it appears in Portrait. I would like to make it appear in landscape mode if the user rotate his iPhone. How to enable landscape mode as in this case? I know there are "dirty hacks" to do this but I prefer something cleaner. Also I do not want the UIWebView switches to landscape but just that the videos can. 回答1: I finally adjusted my view so that it supports

iOS: WebView Loading a url

我的未来我决定 提交于 2019-12-05 13:37:04
问题 I am trying to open the following url in UIWebView but it fails to load whereas changing it to: http://www.google.com works fine. The url that I want to load is: [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@%@%@%@",@"http://m.forrent.com/search.php?address=",[[bookListing objectForKey:@"Data"] objectForKey:@"zip"],@"&beds=&baths=&price_to=0#{\"lat\":\"0\",\"lon\":\"0\",\"distance\":\"25\",\"seed\":\"1622727896\",\"is_sort_default\":\

add UIButton as subview of UIWebView and resize it when zoom

我的未来我决定 提交于 2019-12-05 12:43:07
I have the image of the World map in .svg that i load into UIWebView . (I used svg format and UIWebView because the image is too big to load into UIImageView) I would like to put a bunch of Pin on this map with fixed position. For example if I put a pin in Brazil, this pin must always remain on Brazil, no matter if I scroll or zoom the UIWebView how you can do this? for now the scroll is not a problem but only the zoom NSString *path = [[NSBundle mainBundle] pathForResource:@"map" ofType:@"svg"]; NSURL *url=[[NSURL alloc] initFileURLWithPath:path]; NSURLRequest *request=[[NSURLRequest alloc

HTML marquee not working in iOS 5.1

半世苍凉 提交于 2019-12-05 12:27:25
Please see below function. -(void)loadHTMLinWebView { objWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; objWebView.opaque = NO; objWebView.userInteractionEnabled = NO; objWebView.backgroundColor = [UIColor clearColor]; NSString *strTemp = @"<html><body style="margin-top:0px; margin-left:0px; text-align:center"><marquee behavior="alternate" style="font-family:Marker Felt;font-size:20px; color:#A52A2A;">Test</marquee></font></body></html>"; [objWebView loadHTMLString:strTemp baseURL:nil]; [self addSubview:objWebView]; } Above is the