in my UIImagePickerController (camera shooting view), I want to track touches.
Every touch event gets properly called except for touchesbegan:
It's not a typo or something because touchesbegan: had been called up to the moment,
I've changed the controller from UIViewController to UIImagePickerController.
Why is touchesbegan: not called in UIImagePickerController?
How do I achieve this?
Update: It works. But only on the controls (which are located at the bottom). It doesn't work in the camera live picture.
Add a transparent view over the preview area, subclass UIView and capture touch events there?
Related
I have developed an application on the appstore that uses an overlay over the camera (UIImagePickerController) which the user can pan and zoom using touch gestures. The overlay view is a subclass to a UIView and overrides the touches events from UIResponder to modify the overlay view accordingly.
This works fine in iOS3-4 but zoom stopped working for iOS5. It seems as the UIImagePickerController does only forward single touch events and takes over the pinching gestures to enable zoom of the camera.
Do anyone know how to handle this? I would like to disable the zoom of the camera and enable it on my overlay view again.
Solved by adding the Overlay view on top of window instead of using cameraoverlayview.
What I want: Touch a button and a view is added right where the touch is. Without having to lift the finger the touches began/moved automatically begins working on the UIView. So without lifting the finger, I have touched the button and can drag the new view around.
What I don't know how to do:
Stop the touch events on the button and immediately send the touch events to the new view that is directly under the finger.
One option could be to ditch the button and just use the uiview touches to detect when to add the subview you want to let the user drag...
Daniel
As #Daniel suggested ditch the button and just use a UIView, but I believe you may need to have a UIPanGestureRecognizer in place to get your dragging.
You could set a flag when a new UIView is created and then forward any gesture events to that view - only while the user still has their finger down from the initial touch.
After the user has lifted their finger the new view can just deal with gestures by itself by adding a UIPanGestureRecognizer to it.
I have a UIScrollView which is doing some custom pinch zooming. To do this I subclassed UIScrollView, the overwrote the touch methods touchesBegan, touchesMoved, and touchesEnded. Everything works well and as expected.
My problem comes when I try to add a series of UIView subviews, I can only detect taps on my UIScrollView when the UIView UserInteractions is set to NO. I would like to be able to continue to detect two finger taps on my UIScrollView, AND a single finger tap on any of my UIView subview.
Is this possible?
I've tried countless number of ways with little help. Does anyone have any experience in this?
Cheers,
Brett
Apple's documentation for UIScrollView explains how it does it:
it temporarily intercepts a touch-down event by starting a timer and, before the timer fires, seeing if the touching finger makes any movement. If the timer fires without a significant change in position, the scroll view sends tracking events to the touched subview of the content view. If the user then drags their finger far enough before the timer elapses, the scroll view cancels any tracking in the subview and performs the scrolling itself.
There are a couple of methods for interception given as answers to this question: How to make a superview intercept button touch events?
Any UIView with userInteractionEnabled will block touches from reaching views under it. You may have to rethink how you are structuring your layout. Or subclass the UIView to change how it's handling touches.
I have a view that is moving. The view is sometimes on and sometimes off screen - it is twice the width of the screen.
In this view, there are buttons that I need to be able to click.
I've tried doing this in many ways already - using pure buttons
using touches began on UIView
I'm doing the animation using a CGPath in core animation
Any help would be most appreciated
Thanks
Whether the view is moving or not should irrelevent to the touch detection. If you have a UIButton object and are handling the UIEventControlTouchUpInside (forgot the exact name) event , it should be called when it sees a touch. Is that not working for you?
can we do like that a user touch on the camera view and on this touch we can identify touch locations on this view.
i use the uiimagepickercontroller and added it on a button to the current view, after adding how can i identify the touch on this camera view that pop up after touch on any button.
Thanks
Balraj verma
You can use the new 3.1 Camera API's to turn off the camera controls, and then get a view into which you can add you own subview which detects touches anywhere on the screen.