Mouse Click & Touch/Tap in device

Discussion in 'iOS Programming' started by spilakalb, Oct 15, 2012.

  1. spilakalb macrumors member

    Sep 23, 2012
    I have developed an iPhone app.Its working fine in simulator.I tested the app with Instruments(Leak) and everything is looking fine.
    Can I gurentee that app will work in device also? My question is all the mouse click event in simulator will wok using touch/tap in device?
  2. Reason077 macrumors 68020


    Aug 14, 2007
    Obviously, mouse clicks in the simulator and taps on the device screen should be equivalent as far as your app is concerned. If they weren't then the simulator would be a lot less useful!

    However, it's always best to test on a real device if you can. I wouldn't recommend submitting/releasing an app that has only been tested on the simulator.
  3. spilakalb thread starter macrumors member

    Sep 23, 2012

    I am confused with TouchEvent

    touchesBegan:withEvent: – Sent when fingers are touched down.
    touchesEnded:withEvent: – Sent when fingers are touched up.
    touchesMoved:withEvent: – Sent when fingers move on the touch screen.
    touchesCancelled:withEvent: – Sent when a touch was interrupted by a an event such as a telephone call.

    I didnt implement these method in my code. In which scenario we need to use these methods?.
  4. jnoxx macrumors 65816


    Dec 29, 2010
    Aartselaar // Antwerp // Belgium
    When you want to override these methods?
    You don't really understand the responder chain I guess, the API deep inside APple itself will check what points that are touched on your screen, and your app will respond to that for example like buttons and such, because this is all Apple style. But for example, when you want to draw something on the screen where the user just has been with his finger, then you could use the touchesbegan, these are just methods sended from the API, like delegate methods, so you don't have to use them, but you can use them to do something else.
  5. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    No. That is why it is important to test your app on real devices and not just rely on the simulator. In your case, your click targets might be so small that only a mouse can click them but fingers cannot. (Although, that would be bad UX as well.) That's just one reason to test on a real device.
  6. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    Testing on a Simulator is insufficient to ensure a working usable app.

    The API support is slightly different on the device, the memory, processor and graphics performance can be vastly different, and using a small multi-touch device when not at a desk can be quite different. Stuff that is easy to see and do sitting still in front of a large monitor with a mouse easily becomes nearly invisible and impossible to see, touch and control while walking, in transit or on the road.

    So you really need to test on an actual iOS device (or just get purely lucky).

    You might only need to override the TouchEvents if you want more information than usual about an event (exact XY coordinates and speed in some subview, etc.), otherwise, just let the UI objects and gesture recognizers figure out stuff for themselves.

Share This Page