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

Reply
 
LinkBack Thread Tools Display Modes
Old 02-02-2012, 03:01 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2012
Posts: 2
ironfish8 is on a distinguished road
Default Maintaining a list of all active UITouch'es

Hi,

I need to maintain a list of all active UITouches (sorted).

touchesBegan/Ended/Moved appear to be called at random intervals and each have a list of different touches in different phases (not all relative to the function name).

My idea is to maintain an NSMutableDictionary.

touchesBegan:
Add to the list (if the [touch hash]) doesnt already exist. (And the phase is began)

touchesEnd:
Remove from the list (if the [touch hash]) exists. (And the phase is ended)

touchesMoved
Update (?) the UITouch. However the UITouch pointers will be valid? Or will they have been released, i.e. Should I maintain my own allocated list of UITouches and copy over the data for each time we recieved touchesMoved?



Thanks for clarifying!


Ashley.
ironfish8 is offline   Reply With Quote
Old 02-02-2012, 03:23 AM   #2 (permalink)
Registered Member
 
Join Date: Nov 2009
Location: Helsinki
Posts: 304
fiftysixty is on a distinguished road
Default

The pointers should remain the same for the lifetime of a UITouch object, though it does somehow feel risky to make that assumption when the documentation doesn't explicitly state it. But that's they way Apple's own example codes handle tracking individual UITouch objects, so it should be ok. By the way, you could also take a look at Cocos2D as they have implemented some touch object handling stuff there, it might be useful for you.
fiftysixty is offline   Reply With Quote
Reply

Bookmarks

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: 412
16 members and 396 guests
Atatator, chiataytuday, dre, FrankWeller, imac74, ipodphone, jeroenkeij, kukat, LunarMoon, MAMN84, n00b, PowerGoofy, QuantumDoja, Retouchable, tim0504, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,675
Threads: 94,124
Posts: 402,909
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Retouchable
Powered by vBadvanced CMPS v3.1.0

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