Recognising touch events in iPhone - iphone

If the user writes "t" on the particular touch area, the iPhone should recognise it and it should be displayed.
Where should the user write? Is there any specific area like UItextfield and how is it recoginised (letter written by the user)?

Apparently there is something that's called UITextField and you can access it's properties. But you should (TOTALLY) read through the developer.apple.com stuff first. There are also some nice videos on youtube and on apple that will help you get an entry.
Please! don't be lazy and learn about the basics! If you have any further questions about usage or something else: Use the Forum Search! Google it! Then ask your question!

You can subclass the UIVIew and create an new custom View.
Define the following methods:
touchesBegan:withEvent:
touchesMoved:withEvent:
touchesEnded:withEvent:
touchesCancelled:withEvent:
Each time user starts touching and ends the touch record the set of of points user has traveled and use these stored values in drawRect Method to draw lines between them.
Implement drawRect: method in your custom view and do the drawing of lines according to the users touch points.

You can also consider creating a gesture recognizer for this. This is the basic guide that can get you started.

Related

What is the imagePickerController delegate method before the didfinishpickingmediawithinfo method is called?

So I have a visual cue (PNG rectangle lines) that pops up when taking a picture for this test app I’m doing.
So I remove the visual cue in the did finish picking media delegate method and/or the didcancel method as well. But I can’t find info on a delegate method for inbetween. Is there one? If there isn’t, is there a way to handle using a visual cue during image taking but not during the deciding “phase”?
I've looked at the Apple Docs but can't find anything so far. I'm trying to be better as far as attention to detail but I still struggle so my apologies if I didn't see it
I don't think there's code necessary to show so I can't show sample code.
No, the only delegate methods are imagePickerController(_:didFinishPickingMediaWithInfo:) and imagePickerControllerDidCancel(_:).
If you want to customize the user interface during picture taking, you can take a few approaches.
First, use the cameraOverlayView property to customize the UI.
Second, note that the UIImagePickerController is itself a UINavigationController. You can therefore set its delegate and respond to navigationController(_:willShow:animated:) to be notified when the user is about to move between view controllers. You could implement logic here to show, hide, or otherwise adjust your custom UI.

showing touches on iOS device like in the simulator

For the purposes of making app demos and presentations, I would like to draw circles corresponding to touches, just like in the iOS simulator, but on the device itself.
Ideally, this would be orthogonal to other code. Perhaps a UIView which draws the circles and forwards the events, but event forwarding seems to require the other views be aware:
http://developer.apple.com/library/ios/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/MultitouchEvents/MultitouchEvents.html#//apple_ref/doc/uid/TP40009541-CH3-SW17
Is there a clean way of doing this?
(I can't use the simulator for demos because my app uses gestures, MIDI, and OpenGL)
thanks!
There is a framework call fingertips which is available through cocoapods.
http://cocoapods.org/?q=on%3Aios%20fingertips
This will do what you are asking.
I don't think there's a clean way of doing this. However, this is what I would try:
Use method swizzling to hook up to all your views by swizzling the methods
- touchesBegan:withEvent:
– touchesMoved:withEvent:
– touchesEnded:withEvent:
for the UIView class. In addition, you may also need to swizzle some methods of UIGestureRecognizer subclasses, since they may prevent the methods listed above from being called. This way you can do your own thing (e.g. draw the touch points on the screen), and also let the views handle the touches as before.

GSEvent and multiple fingers

I am successful in monitoring raw touches using GSEvent by hooking sendEvent. How do I extract touch information when multiple fingers are involved?
Update 1: iOS 5.01
Update 2: I managed to do this by going over the allTouches set contained in the event passed. It works fine, but bogs down a when gesture recognizers kick in for a 4 or 5 finger event..
You are kind of right. By overriding the sendEvent: method, and then getting the GSEvent from the UIEvent, you can get the underlying sytem information you are looking for. You could watch the "infoSize" field in the GSEvent record, which should tell you how many touches are involved in the event... But why use GSEvent? You could just put one big UIView in your application, set it's multiple touch interaction property as YES, override it's sendEvent method, and you should get every touch in there, even the 4 and 5 finger gestures. You can forward touches that are not important for you, and don't forward the ones that are not.
Hope this helps.

Swipe Gestures and drawing user touches error

i have UISwipeGestureRecognizer that detects if the user has swiped. i also draw the users touches using the touches moved method found in the tutorial below.
http://www.ifans.com/forums/showthread.php?t=132024
My issue is the gesture seems to override my drawing. is it possible to do both or is there a better way of doing this?
Thanks
Dan
All of the touches methods get overridden when you invoke a gestureRecognizer. You can view it here in the explanation. It may be best to just write your own code to recognize a gesture if you need all of the touch events for drawing updates. If you still want to use a gestureRecognizer, you can use the locationInView: method to find the location of the touch, and then pass those points to your draw method.
I would also think about using OpenglES instead, as it isa bit easier, and you can do more things. There's a great sample project about it here. Hope that helps!

How to simulate touch event?

I want to be able to invoke touch events without user interactions.
Is this possible?
you could manually call touches begin and touches end.
I think there may be a better solution to whatever you are trying to do, This seems like a very unconventional thing to do.
Have a look at UIResponder's touchesBegan:withEvent: and touchesEnded:withEvent: