uiwebview

How to localize some strings from a HTML file that is displayed in a UIWebView controller under iOS?

久未见 提交于 2019-12-11 10:16:22
问题 I am looking for a way that would allow me to localize some strings from inside a HTML file that is displayed in a UIWebView under iOS. I want to use NSLocalizesString() for doing the localization, so I am looking for a simple solution that would like me to generate the localized html file before displaying it. I do have full control over the HTML file and plant to use some kind of placeholders. 回答1: Use a custom tag then, parse the HTML with NSXMLParser, and anything within your custom tag..

UIWebview is not loading youtube video in iFrame

微笑、不失礼 提交于 2019-12-11 09:57:24
问题 I'm trying to load an HTML string into a UIWebView . The HTML contains an iframe , but it does not load in the webview. Here is my code, webDescription = [[UIWebView alloc]initWithFrame:CGRectMake(0, 255,self.view.bounds.size.width, 20)]; [[webDescription scrollView] setBounces: NO]; webDescription.delegate = self; NSString *myDescriptionHTML = [NSString stringWithFormat:@"<html> \n" "<head> \n" "<style type=\"text/css\"> \n" "body {font-family: \"%@\"; font-size: %@; COLOR:#111111;

'NSURLRequest?' does not have a member named 'URL' - Swift

喜夏-厌秋 提交于 2019-12-11 09:32:53
问题 Hi I am really new to coding in Swift, and am trying to follow the codes in this book: http://www.apress.com/9781484202098. Learn iOS 8 App Development 2nd Edition by James Bucanek In particular, I am working through Chapter 3 - building a URL shortening app, but despite having copied the code exactly, I am getting an error on the code in Page 76: if let toShorten = webView.request.URL.absoluteString { which states 'NSURLRequest?' does not have a member named 'URL'. I have tried googling an

Get UIWebView content and convert it to image

主宰稳场 提交于 2019-12-11 09:26:55
问题 I'm using a UIWebView . I call a web service to get the content for that. In web service response I get HTML string as below: <div style='text-align: center;'> <div style=' display: inline-block; width: 120px;height: 120px; text-align:center; '; ><img src='http://assetdetailsdemo.azurewebsites.net/QRUpload/4774.jpg' style='height:100px; width:100px' /><br /><div>4774</div></div> <br /><br /></div> This is just an example. I may get 'n' number of above kind of 'div' tags which may have images

POST with swift 2 on UIWebView does not work

半世苍凉 提交于 2019-12-11 09:18:18
问题 Before swift 2, the code below used to work. However after upgrading to Swift 2, my code below no longer worked. I had verified with Postman and RESTClient that my web services worked. let url = NSURL(string: "https://") let mutableURL = NSMutableURLRequest(URL:url!) mutableURL.HTTPMethod = "POST" let str = "user_id=90031963" mutableURL.HTTPBody = str.dataUsingEncoding(NSUTF8StringEncoding) leaderboardWebView.loadRequest(mutableURL) Any comments and feedback will be very much appreciated.

how to increase size of text in web view

旧城冷巷雨未停 提交于 2019-12-11 09:14:04
问题 i have a web view and i want to increase size of text in it when i press button ... 回答1: Try this: [webView stringByEvaluatingJavaScriptFromString:@"document.body.style.zoom = '1.5';"] This will zoom in all contents of the UIWebView by a factor 1.5. 来源: https://stackoverflow.com/questions/3613724/how-to-increase-size-of-text-in-web-view

Android WebView : Why I can not able to redirect to play store from WebView?

♀尐吖头ヾ 提交于 2019-12-11 09:06:36
问题 I am trying to pass url to webview that should redirect to play store but Its not working. What I tried : String url = "https://play.google.com/store/apps/details?id=com.matchify"; webView.loadUrl(url); but its loading only inside the webview, how can I solve this? Thanks in advance 回答1: To open your app's / any other app's page on play store app use : startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackName))); Where appPackName is: String appPackName =

Check if link pressed in UIWebView

▼魔方 西西 提交于 2019-12-11 08:55:39
问题 I have a UIWebView which is set the URL like this: let url = NSURL (string: "http://google.com"); let requestObj = NSURLRequest(URL: url!); webView.loadRequest(requestObj); However I'd like to be able to check if the user as pressed a link. I tried something simple like this: if (url != "http://google.com") { println("Do Stuff"); } which worked fine, however this only checks it in the viewDidLoad I'd like to now every time a link is pressed or when the URL changes. 回答1: You can check the URL

UIWebView: how to hide part of the content of a webpage?

可紊 提交于 2019-12-11 08:45:38
问题 In my app I have a webview that is used solely for displaying the facebook page. However, the client does not want the top blue bar of facebook to appear; he wants to hide it. Is there a way to do this? The bar is 45 pixels, so what I did is I moved the UIWebView in IB in such a way that its top 45 pixels are behind my navigation bar (thus not appearing). However, this is not an ideal solution, as the user can see that content when he scrolls up, before bouncing. He can see but not touch it,

UIWebView JavaScript Injection

巧了我就是萌 提交于 2019-12-11 08:38:54
问题 I've been looking at enough blogs so I'm pretty sure how it's coded... but none of them seem to mention where the javascript injection goes in the Obj-C code? Basically all I want to do is get rid of a header on all the pages the user can navigate to (or at least the page that initially loads... I'll worry about subsequent pages later if it's an issue. keep it simple, stupid ). Here's the code I have: [self stringByEvaluatingJavaScriptFromString:@"document. getElementById('login').childNodes