uiwebview

Resizing text in UIWebView - Swift 3

↘锁芯ラ 提交于 2019-12-04 07:02:25
I having a problem, resizing text within a UIWebView , the html file is located within the bundle. I have managed to get a modified script to work within obj-c , however using swift 3 there is no change to the text size, although the optimal value changes correctly at each click of the button . Here is the code - import UIKit class ViewController: UIViewController { @IBOutlet var resWebView: UIWebView! @IBOutlet weak var increaseFont: UIBarButtonItem! @IBOutlet weak var decreaseFont: UIBarButtonItem! var defaults = ["textFontSize":40] @IBAction func fontButtonPressed(sender: UIBarButtonItem) {

How do I save the contents of a UIWebView as an image

与世无争的帅哥 提交于 2019-12-04 06:25:56
问题 I want to save the content of UIWebView as an image. The code I have only saves the content of the webpage that is visible on the screen. - (IBAction)saveImage:(id)sender { UIGraphicsBeginImageContext(webCanvas.frame.size); [self.webCanvas.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage =UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(viewImage, nil,nil,nil); } I want it so it will save the whole webpage in the

Scrolling a webpage inside UIWebView

别来无恙 提交于 2019-12-04 06:21:14
I have a UIWebView and UIButton added as subview to my View. I also have a large webpage displayed inside my UIWebView , is it possible to scroll the webpage by clicking a button on the UIView ? I want to make the webpage scroll untill it reaches the bottom of the document. The javascript to be used is : window.scrollTo(xPos, yPos); Is it possible to make a javascript call on the button action which will scroll the web document inside the UIWebView ? Albrecht You can use that on your UIWebview component: NSString *yourScript = [NSString stringWithFormat:@"javascript_method();"]; NSString*

iOS中UIWebView的使用详解

ε祈祈猫儿з 提交于 2019-12-04 06:16:12
iOS中UIWebView的使用详解 一、初始化与三种加载方式 UIWebView继承与UIView,因此,其初始化方法和一般的view一样,通过alloc和init进行初始化,其加载数据的方式有三种: 第一种: - ( void )loadRequest:( NSURLRequest *)request; 这是加载网页最常用的一种方式,通过一个网页URL来进行加载,这个URL可以是远程的也可以是本地的,例如我加载百度的主页: UIWebView * view = [[UIWebView alloc]initWithFrame:self.view.frame]; [view loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.baidu.com"]]]; [self.view addSubview:view]; 会得到如下的效果: 第二种: - ( void )loadHTMLString:( NSString *)string baseURL:( NSURL *)baseURL; 这个方法需要将httml文件读取为字符串,其中baseURL是我们自己设置的一个路径,用于寻找html文件中引用的图片等素材。 第三种: - ( void )loadData:( NSData *)data

How to play youtube video without UIWebView or detect video player when youtube video start playing using webview?

爷,独闯天下 提交于 2019-12-04 06:01:15
I need to play youtube video in my iOS application and while video is playing I need to add an overlay on video. 1.Now how can i run youtube video in native player? 2.if I play video in UIWebview then how can i detect that video is playing and how to add overlay on the video? MPMoviePlayerViewController cannot directly play youtube video urls.You need to extract the url before loading MPMoviePlayerViewController with the url. you can see a working demo in my github repo: Try this:: https://github.com/DpzAtMicRO/IOSYoutubePlayer LBYoutubeExtractor extracts the youtube Url with JSON. Please do

Use Adobe Reader to open a PDF from own app using WebViewController

被刻印的时光 ゝ 提交于 2019-12-04 05:55:48
问题 In my iPad app, I have a button that opens a document using a WebViewController to view the file. For certain PDF documents that were viewable in iOS4, opening them on iOS5 now crashes the app. The same thing happens in Mail if I try to view these PDF documents that are attached to emails. However, if I tap and hold in Mail and select "Open with Adobe Reader," the document opens successfully. Is there a way to change what is used to generate the view of the PDF in the WebViewController to use

Swift how to design UIWebView Auto resize full screen in Story Board

余生长醉 提交于 2019-12-04 05:39:39
问题 I designed a UIWebView with 320x500 in StoryBoard. But when run in Iphone 6 Plus Simulator, i want to this webview full screen or scale with the screen of device. How to make it in storyboard? I wrote code in ViewDidLoad but not working. override func viewDidLoad() { super.viewDidLoad() self.detailWebView.frame = self.view.frame; println("H:\(self.view.frame.height), W:\(self.view.frame.width)") self.configureView() } Seem to be self.view.frame height and width that true, but size of this

Swipe gesture for back/forward in UIWebView?

人盡茶涼 提交于 2019-12-04 05:30:53
I have a WebView in my app. Because it is a tabbed application I'm not able to add buttons for going back/forward on the website. I want to go back/forward by swiping. Right swipe from the left side/edge is back… like in Safari browser for iOS. How can I do it? I think i should use "Screen Edge Pan Gesture Recognizer", right? Why not just use a swipe gesture recognizer? UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)]; UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:

How do I pass login information to a website from UIWebView directly without any need of logging in once again?

[亡魂溺海] 提交于 2019-12-04 05:23:29
I want to open some website in my iphone app using UIWebView. The website requires username and password and I have these username and password. I was wondering is there anyway I can open the website in my UIWebView without any login screen? I mean as I already have the username and password, can I use this information to log in to website automatically and show the required necessary page onto my UIWebView iphone app. I just want to get rid of logging to website as users have already entered the login information when they open the app. Thats redundant. Any help is greatly appreciated. Thanks

Cannot convert value of type 'NSURL?' to expected argument type 'URL'

本小妞迷上赌 提交于 2019-12-04 05:07:10
问题 The error message I get from this code segment is "cannot convert value of type 'NSURL?' to expected argument type 'URL'". When I go onto my web browser, I can see the pdf file so I know it is working. The pdf files are stored a remote server. Please help! override func viewDidLoad() { print("dir2: \(dir2) dir1: \(dir1)") let targetURL = NSURL(string: "http://example.com/\(dir1)/\(dir2).pdf") let request = NSURLRequest(URL: targetURL) //this is the line with error. webView.loadRequest(request