uiwebview

Hide text selection handles after action in UIWebView

强颜欢笑 提交于 2019-12-02 17:17:33
I have several custom UIMenuItems that do things with a selection in a UIWebView . After the action has been run on that selection I want to hide the selection handles just as copy: does. I have tried using window.getSelection().removeAllRanges(); and that works in that window.getSelection() no longer returns anything but the text selection handles stay visible. Is there a way to remove the selection and the handles with it? Edit: I don't need it to be a JS solution but I can't loose the state by reloading the webview. Just disable and re-enable the User Interaction: myWebView

new UIPDFPageRenderOperation error with iOS 9.3?

和自甴很熟 提交于 2019-12-02 16:39:12
I'm adding some PDF links to my UIWebView and every time one loads and I make a scroll gesture, I get this error: objc[910]: UIPDFPageRenderOperation object 0x14acaca10 overreleased while already deallocating; break on objc_overrelease_during_dealloc_error to debug So, is the UIPDF is being deallocated while I try to scroll? Anyone have a hint? kejoki My solution was to disconnect the iPad from the Mac and run separately Xcode or Instruments. The crashes with an overrelease PDF error went away. Kinda stinks that I can't open any of the controllers/views where there is a webview with a PDF

How to insert HTML into a UIWebView

人走茶凉 提交于 2019-12-02 16:38:46
I have HTML Content which was being displayed in a UITextView . The next iteration of my app is display the HTML contents into a UIWebView . So, I basically replaced my UITextView with UIWebView . However I could not figure out how to insert my HTML snippet into the view. It seems to need a URLRequest which I do not want. I have already stored the HTML content in memory and want to load and display it from memory. Any ideas how I should proceed? This should do the trick: NSString *myHTML = @"<html><body><h1>Hello, world!</h1></body></html>"; [myUIWebView loadHTMLString:myHTML baseURL:nil]; -

UIWebView background color

六月ゝ 毕业季﹏ 提交于 2019-12-02 16:29:55
I am loading an HTML string into a UIWebView in order to be able to view rich text. So far, so good. But I have one small problem: in my Nib file, I set the background attribute to green. However, when it is displayed, the background is white. Then, in the class file, I added the following [myWebView setBackgroundColor:[UIColor greenColor]]; [myWebView loadHTMLString:myString baseURL:nil]; However, the background is still white. I even tried reversing the order, but still comes out white background. There is more text than the size of the UIWebView. I noticed that when I scroll down past the

Make a UIWebView as height as its content with Auto Layout

非 Y 不嫁゛ 提交于 2019-12-02 16:23:05
I've got a web view embedded in a scroll view, and I want the web view to be "expanded" to show all of its content, which I then want to scroll through with my scroll view. The reason I am using a scroll View as a super view and not just using the web view as a scroll view is because I have labels above the web view that I want to include in the scrolling process (see screenshot). So how do I make the webview resize itself so it takes up all the space it needs to show the content it contains ? And after that, how do I make the superview (the Scroll view) resize itself according to the size of

UIWebView throwing exception for [WebActionDisablingCALayerDelegate setBeingRemoved:]

女生的网名这么多〃 提交于 2019-12-02 16:05:00
When running against iOS 8, I began to see the following exception coming from the deep bowels of UIWebView : [WebActionDisablingCALayerDelegate setBeingRemoved:]: unrecognized selector sent to instance 0x167ee900 * WebKit discarded an uncaught exception in the webView:willRemoveScrollingLayer:withContentsLayer:forNode: delegate: -[WebActionDisablingCALayerDelegate setBeingRemoved: This is happening when I change some constraints on my UIWebView and then call: self.webViewWidthConstraints.constant = newWidth; [self.webView setNeedsLayout]; [self.webView layoutIfNeeded]; (This is so that the

How to get rid of the status bar background on the UIWebView?

随声附和 提交于 2019-12-02 15:53:06
问题 Since iOS 11, when the UIWebView is full screen, a fake background appears on the status bar with the same color of the UIWebView background. Anyone knows how to get rid of it? Even adding the IUWebView to a storyboard and make it full screen will make the status bar background to appear I've been trying to edit the size and some other properties of the UIWebView and none of them worked, but it's definitely something from the UIWebView. Also tried to see all the subviews and it's sizes and

dispatch_async UIWebView loadrequest

≯℡__Kan透↙ 提交于 2019-12-02 15:42:50
问题 I'm loading a javascript which is in my App, the script will try to find a solution, which can takes some time. I don't want to wait more than 5 seconds for that solution, in that case I just want to stop the request and show a message to the user. I've been trying to do it with NSTimers and with dispatch_async, but the UIWebView request is still using my whole main queue, and the NSTimer is stopped in the meantime I'm waiting for the answer. The request call: webViewUIView.delegate = self

Pros and cons of MPMoviePlayerController versus launching UIWebView to stream movie

試著忘記壹切 提交于 2019-12-02 15:39:11
I have a client who has video content for the web in Flash format. My task is to help them show the videos in an iPhone app. I realize that step one is to get these videos into the appropriate Quicktime format for the iPhone. Then I'm going to have to help the client figure out how or where to host these files. If that's tricky I assume they can be hosted at YouTube. My chief concern, though, is which approach to take to stream the video. What are the pros and cons of MPMoviePlayerController versus launching UIWebView with the URL of the stream? Is there any difference? Is one of them more or

How to extract text contents from html like Read it later or InstaPaper Iphone app?

孤街醉人 提交于 2019-12-02 14:19:36
I want to extract main article content from html on my Iphone app and show it on TextView or CoreText. Read it later and InstaPaper Iphone apps have this feature, but after researching on web, I still can't tell how they do this. At the moment, I take text content from html by this code, but it takes lots of no need contents too. textArticle = [webView stringByEvaluatingJavaScriptFromString:@"document.body.innerText"]; This question is what I wanted, but sadly it was not for Iphone app. Instapaper-like algorithm This is open source for this kind of feature, but I am not sure if I can use it