uiwebview

Hide text selection handles after action in UIWebView

烈酒焚心 提交于 2019-12-20 08:49:40
问题 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

UIWebView gets cleared after dismissing a fullscreen modal

我是研究僧i 提交于 2019-12-20 07:37:07
问题 I have a UIWebView which loads a html string on viewDidLoad. It detects if the user clicks a link and display a modal view, but when i close the modal view the UIWebView's html has gone! If i use a FormSheet Modal Style the content stays behind, its only fullscreen modals that cause this. Obviously i can just input the html string again on viewWillAppear which fixes it but this causes makes the content flick back on which i don't want. heres my code: -(void)viewDidLoad { [self loadArticleText

Navigating a Pdf using UIWebview not working in IOS 5

血红的双手。 提交于 2019-12-20 07:14:58
问题 I have recently upgraded to Xcode 4 and I've found that an app which has worked perfectly well for over a year is now not working under Ios 5. The app navigates a Pdf in UIWebview and uses the following code to move to any page within the Pdf. [self.pdfNavigateController.webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"window.scrollTo(0, %d);", self.pdfNavigateController.scrollPosition]]; When I use any simulator from 4.2 down the code works perfectly but under the

uiwebview with header and footer

℡╲_俬逩灬. 提交于 2019-12-20 06:03:30
问题 I am trying to add header and footer (both of them as UIViews ) but for some reason my footer sticks to the bottom, I'm using the KVO method for watching my content size. I'm presenting here the method where I think the problem is: - (void)updateLayout { // Update the frame of the header view so that it scrolls with the webview content CGRect newHeaderFrame = self.headerView.frame; CGRect newFooterFrame = self.footerView.frame; newHeaderFrame.origin.y = -CGRectGetMinY([self.webView

multi-tab web browsers with UIWebView on iOS

若如初见. 提交于 2019-12-20 05:42:10
问题 I'm creating a simple web browser. I want my users to add tabs and browse many web pages at the same time, like in Safari, Firefox or Chrome. I've done this and it works great but I don't know if there is a simpler way to do this. When the user adds a new tab, my application creates a new UIWebView in the background that is related to the new tab and loads a new URL. When the user selects another tab, the UIWebView that is related with this tab appears and the other disappears. Just it.. 回答1:

How to open cyrillic domain in UIWebView?

假如想象 提交于 2019-12-20 04:54:20
问题 I try to open cyrillic url in UIWebView, but it's can open. I use the following code% urlString = [NSString stringWithFormat:@"http://%@", urlString]; urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; url = [NSURL URLWithString:urlString]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [_webView loadRequest:request]; If i try to open https://www.google.ru/webhp?q=президент#newwindow=1&q=президент everything is OK, but when I try to open

Open link starting with http but not www

旧时模样 提交于 2019-12-20 04:34:10
问题 I want to open link starting with www they do not open. My code working only for http. Please help > I am newer in iOS.I shall be highly obliged. - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { if (navigationType == UIWebViewNavigationTypeLinkClicked) { NSLog("User tapped a link."); } if ([request.URL.absoluteString rangeOfString:@"iosscrollposition:"].location != NSNotFound) { NSString

Overlay an UIButton over an UIWebView in Swift

泪湿孤枕 提交于 2019-12-20 03:52:06
问题 So I have a view that loads a UIWebView and I want to overlay UIButton the user can tap on to go to another view. I managed to place the button over the web view but I can't seem to be able to tap on it. Here's my code: class ButtonView: UIView { var button: UIButton! override init(frame: CGRect) { super.init(frame: frame) button = UIButton(frame: CGRectMake(0, 0, 50, 50)) button.layer.zPosition = 10 self.addSubview(button) } required init(coder aDecoder: NSCoder) { fatalError("Init(coder:)

How to refer a local image file from UIWebView's HTML on iPhone?

我是研究僧i 提交于 2019-12-20 03:46:09
问题 I would like to use <img src=" temp.jpg " /> in my UIWebView's HTML. How can I refer to a local file named temp.jpg to save precious loading time? Of course the obvious choice would be <img src=" .\temp.jpg " /> but I have no idea where my root is... 回答1: NSURL *url=[[NSBundle mainBundle] bundleURL]; [webView loadHTMLString:string baseURL:url]; This let's the root be the app's main bundle. 回答2: This will create a URL object that contains the location of your file on disk. You can then use

Question about UIWebview and Universal Application

佐手、 提交于 2019-12-20 03:37:12
问题 I have an Universal Application and my question is, if it is possible to load two different html files in my UIWebview depending on the iDevice. Thanks for any answers. 回答1: you can use this... if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)//if device is ipad { } else //if device is iPhone { } 回答2: You can use UIDevice class. UIDevice *device = [UIDevice currentDevice]; if ([device.model isEqualToString:@"iPad"]) { } else { } 来源: https://stackoverflow.com/questions/6290782/question