I want to handle copy/select/selectAll/Patse options of UIResponderStandardEditActions in webview. but i am facing problem, the copy action never called and also i observed that , in function((I have webview where i am displaying text using TTStyledTextLabel)..
canPerformAction:(SEL)action withSender:(id)sender
The copy: action never comes..but i do see that all other options like select , selectAll and cut actions getting called, even though the copy action never called in above function when i select text in webview the copy action is enabled but action never gets called..
Have you solved your problem yet? If you did please post your solution. I'm having the same problem with the paste function.
The solution I found, and I know it's not ideal, its to detect the events through javascript.
I use javascript to detect when a paste happens, call my objectiveC function to work with the data, and call a JS function from the objectiveC to paste the content on the webview.
Related
I am working to automate an android app which have some screen of webview too. I am unable to click the right element through xpath class, with index or even with giving name text.
If you see these screenshots it is visible that when I inspect element i get link to somewhere else. i tried using getlocation and then pass it for click but it also getting me wrong click.
I tried touchaction class methods but they are not working. My code get pass through appium but the methods tap or press nothing.
I tried this way too but no luck.
WebElement Quiz1 = (new WebDriverWait(driver , 20))
.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//android.view.View[contains(#content-desc,'Die Wish App')]")));
Quiz1.click();
Any help would be appreciated. Also how can I use webview rather than webelement? and which one is preferable?
You can click on the element which you have highlighted in the screenshot.Below is the locator to identify that element
By.accessibilityId("Die Wish App")
I'd like to show Appirater when I click some button.
here is my setting in appdelegate
Appirater.setAppId("...")
Appirater.setDaysUntilPrompt(0)
Appirater.setUsesUntilPrompt(0)
Appirater.setTimeBeforeReminding(30)
Appirater.setSignificantEventsUntilPrompt(10)
Appirater.userDidSignificantEvent(true))
Appirater.appLaunched(true)
and then I put below code in my view controller
Appirater.tryToShowPrompt()
I don't any idea how to call correct method in action.
You will be able to use forceShowPrompt method. However by forcing the prompt consider the side effects. By the way if you want to see the Appirater on the debug mode always, you can use Appirater.setDebug(true) method.
I'm debugging an iOS app in Xcode, and I'm wondering is there any way to see which line of code I just ran? I'm trying to figure out where the code is that is responsible for making a menu slide open when I tap the menu key.
Thanks
Set a breakpoint (tap on a line number in Xcode) and manually run the code line by line using Xcode's Debug menu. In your case you can set a breakpoint on the method that is executed when a button is pushed. If you do not know which method is called when you push the button, you could look at where the button is declared, which should have a addTarget method, or see what it is hooked up to in the Storyboard.
If you have a few places where you think the code is executed, you can use NSLog() statements and see what is being printed to the console at what time.
I am writing a news application for iOS using MonoTouch. The data comes via an OData web sevice.
I have a singleton class called NewsFactory which is responsible for querying the OData feed. Now in the ViewDidLoad method I am retrieving the list of news articles and binding it to the table view.
However - I am not sure how to refresh this every time the app is launched. I don't care much for "pull to refresh". All I want to make sure is that every time the app is launched (from scratch or activated again) that the call to the web service is made to make sure I show the latest info.
In addition, I want to cover for the scenario where the network connectivity is lost when the app is launched and I notify the user. The use closes the app (suspend) and let's say the network connectivity returns - If the user opens the app again, I would like to make sure that I show the latest news articles.
I am building the view hierarchy programmatically. I have navigation controllers and a tab bar controller with 5 tabs.I am targeting iOS 5.
I tried playing with OnActivated and ViewWillAppear and they don't do exactly what I need to do. This is a very common need for any iOS app so there must be a solution - I am new to this so any help is appreciated.
Well you have to think, in general, if you call a method that loads from one source (let's say a text file that has data in it), then you change up the source (change text data), but call the same method when the class is loaded, then the new data will appear when the new class is loaded.
Like for example:
- (void) loadView {
NSString *testString = [NSString stringWithContentsOfFile:filePath];
textView.text = testString;
}
This example shows the setting of text in a file to a UITextView instance. If you load it the first time and the file contained the contents of "Hi", then the textView will say hi. If you change it, then call the same method, then it will show your changed text the second time you load the app.
The point is that if you change data, then call the same method, then you'll see a difference. Unless you're working with a database.
I'd give you a better example if you provide sample code.
EDIT: Not sure if your custom class comes with this function, but it is included in the regular UITableView class:
[tableView reloadData];
You can call that after your array changes internally.
How to hadle copy: paste: cut: events in UIWebView?
As Apple says, we can not subclass UIWebView,
so how can I handle UIResponderStandardEditActions?
Maybe someone faced with such a difficulties...
I need to implement custom copy,cut,paste in order to copy/paste html (RTF text, some custom html elements).
In addition, I have 2 webviews, so if I paste some elements in one, another one should reply for this interaction.
Unfortunately, I think you are going to have to make your own copy/paste menu.
Using the answer from this question you can set up custom copy/paste buttons, and you could handle everything you are trying to do through those:
[[UIApplication sharedApplication] sendAction:#selector(cut:) to:nil from:self forEvent:nil];
Also, this question shows how to make a custom UIMenuController and use the UILongPressGestureRecognizer to get it to show up on the UIWebView.
I hope this helps. Someone else may know an easier way, but I think this way will work at least.