Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development > iPhone SDK Development - Advanced Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old 01-10-2012, 08:42 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2011
Posts: 122
architectpianist is on a distinguished road
Default Detecting additional touch before move

Hi,
When I use touchesBegan, touchesMoved, and touchesEnded on UIView, I've found that after the first touch, the Began and Ended methods are only called when one of the touches moves. For example:
1. I put one finger down - touchesBegan is called.
2. I put another finger down without moving it - nothing is called.
3. I move any of the fingers - touchesBegan is called, then touchesMoved.
4. I remove one finger - nothing is called.
5. I move the remaining finger - touchesEnded is called, then touchesMoved.
6. I remove the last finger - touchesEnded is called.

But in some apps, especially games, touchesBegan and touchesEnded are called for additional touches right when they begin and end, not after they move. How can I get this kind of functionality?
Thanks!
architectpianist is offline   Reply With Quote
Old 01-11-2012, 07:27 PM   #2 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,002
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by architectpianist View Post
Hi,
When I use touchesBegan, touchesMoved, and touchesEnded on UIView, I've found that after the first touch, the Began and Ended methods are only called when one of the touches moves. For example:
1. I put one finger down - touchesBegan is called.
2. I put another finger down without moving it - nothing is called.
3. I move any of the fingers - touchesBegan is called, then touchesMoved.
4. I remove one finger - nothing is called.
5. I move the remaining finger - touchesEnded is called, then touchesMoved.
6. I remove the last finger - touchesEnded is called.

But in some apps, especially games, touchesBegan and touchesEnded are called for additional touches right when they begin and end, not after they move. How can I get this kind of functionality?
Thanks!
You have to enable multiple touches for the view(s). Set the multipleTouchEnabled on the view(s) to TRUE. It's false by default.

BTW, you should try gesture recognizers. They make handling touch, drag, pan, pinch, rotate, and other gestures a WHOLE lot easier. Do a search on "touches" and look for the sample project of that name. Run the gesture recognizer version of that sample project.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is online now   Reply With Quote
Reply

Bookmarks

Tags
additional, began, ended, touch, touches

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 408
15 members and 393 guests
AReality, bignoggins, BSH, djqbert, Duncan C, epaga, flamingliquid, jbro, jcdevelopments, leighec68, markolo, nobstudio, revg, Rudy, taylor202
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,645
Threads: 94,111
Posts: 402,862
Top Poster: BrianSlick (7,990)
Welcome to our newest member, leighec68
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:05 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0