How to disable long press gesture on UIWebView of iOS - ios

I'm just wondering how to disable the long press gesture on webview in iOS.
I need to disable only long press gesture not others.
should work on iOS 5.0 +
thank you

I want to thank all for help. I finally found the solution after intensive stackoverflow research. For help other :
In the javascript/html, you can avoid dealing with the longpress event.
The solution was given long time ago : Preventing default context menu on longpress / longclick in mobile Safari (iPad / iPhone)
I did it and it is just perfect. Thanks and thanks again.
JM

You could make UIWebView as a super class to one of your custom class, extend it.. and override touchesBegan.. methods from UIView class..

Related

How to prevent iOS Webkit long press on link?

Im trying to disable the long press on webKit to not let the user Save or Copy in Swift 4.
This is the code im using:
webView.stringByEvaluatingJavaScript(from: "document.body.style.webkitTouchCallout='none';")
I have seen some other answer in objective-c
[webView stringByEvaluatingJavaScriptFromString:#"document.body.style.webkitTouchCallout='none';"];
but converting it to swift it doesn't work.
Thanks in advance for any pointers.
There is a property called allowsLinkPreview with that you can enable or disable the long touch previews.
webView.allowsLinkPreview = false

How to engage textView on app launch swift

I am making a calculator with my own keypad and i need the textview to be engaged on create, any ideas or suggestions are greatly appreciated. Sorry, I'm new to iOS
Use becomeFirstResponder of your TextView on View will appear.
For example: TextView.becomeFirstResponder
myTextView.becomeFirstResponder
did the trick

Sending images with iOS 8 custom keyboard?

I've been developing a custom keyboard for iOS 8, but stumbled upon a problem trying to send images using the keyboard. I did some research and it seems like there isn't a simple way to do this with UITextDocumentProxy because only NSStrings are allowed.
Am I either overlooking any simple ways to use a custom keyboard to send images and/or is there any way to work around this issue?
Thanks in advance
Apparently, you are not the only person to try a keyboard like this. If you look at the animated GIF on the site, the keyboard uses copy/paste to add the image to the messages.
The UIKeyInput Protocol, which is inherited by UITextDocumentProxy, has the following function:
func insertText(_ text: String) //Swift
- (void)insertText:(NSString *)text //ObjC
These only take a String or an NSString, as you already know. Because there are no other methods to insert content, it can be assumed that, currently, there is no other way.
Right now, I would suggest that you adopt a similar usage. When the user taps on the image, add it to the UIPasteboard. Maybe present a little banner on top of the keyboard saying, "You can now paste" or something, but that would be up to you to decide.

IBAction in Xcode 4.5

Anybody experiencing no response for IBAction touchUpInside in Xcode 4.5, deployment target iOS 5 as well? It works in simulator for me having iOS6, but not iOS5.
I had this same issue because I was using a tap gesture. You should be able to keep your existing code by adding the line below. This will keep your tap gesture from killing any taps on interior buttons and such...
yourTapGesture.cancelsTouchesInView = NO;
Edit:
I have found the solution. I was adding a tap gesture to the view, which was overriding the view's ability to detect a touchUpInside action on any buttons since they are part of the view as well. So what you should do is either remove the gesture recognizer or make it specific to a certain object. For example, I added the touch gesture to the specified part of the view that was not on the subview (I created a new object / outlet and labeled it as such). Still not sure why it's different in 5.1 vs. 6.0, but this should help you.
Original Post:
I am having the same issue. I have a project where buttons on a subview are clickable on version 6.0 of the simulator but not version 5.1. I have some gesture recognizers in there as well but commented them out to see if they were the issue and they are not. The only thing I have found is that the buttons are sometimes clickable on a touch up outside action (even though they are programmed for touch up inside), so I am not sure if maybe Apple changed the eNums for button actions? If I come up with a solution I will be sure to provide it here.
I just created a new demo project. I added a button to a view, handle touchUpInside, built and tested using Xcode4.5 on both deployment target ios6 and ios5 - both worked just fine. Try with a demo project yourself - won't take more than a few min.

Release Event Handler?

Maybe I'm just over thinking this, but is there a way to capture when the user let's go of a button with iOS? So to pose my question better: I have a button on the screen, and when the user let's go of it, I want to call an event. Is there a way to do that?
Try to answer, I wonder the same idea too..
From Apple Document : UIControl Class
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIControl_Class/Reference/Reference.html
My Idea sub-class UI Control using following Task :
– beginTrackingWithTouch:withEvent:
– continueTrackingWithTouch:withEvent:
– endTrackingWithTouch:withEvent:
– cancelTrackingWithEvent:
Put a BOOL isBegin = YES at beginTrackingWithTouch to know that it was touched..
Then when endTrackingWithTouch happen (which is the user end touching the control), do what you going to do in there then set isBegin back to NO
regards,
FHW

Resources