Thursday, 15 January 2015

objective c++ - UIView subclass ignores second touch -



objective c++ - UIView subclass ignores second touch -

i'm making ios game, , i've written uiview subclass that's supposed grab touch events, , works intended single touch. however, if i'm touching screen 1 finger touch sec finger elsewhere, "touchesbegan" doesn't called sec touch.

here's implementation of class: (objective-c++)

#import "batouchinput.h" #include "botsapp.h" @implementation batouchinput - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event{ (uitouch* touch in touches) { std::cout << "touch started" << std::endl; botsapp::getsingletonptr()->touchdown(touch); } std::cout << "--------------" << std::endl; } - (void)touchesmoved:(nsset *)touches withevent:(uievent *)event{ std::cout << [touches count] << std::endl; (uitouch* touch in touches) { botsapp::getsingletonptr()->touchmoved(touch); } } - (void)touchesended:(nsset *)touches withevent:(uievent *)event{ (uitouch* touch in touches) { botsapp::getsingletonptr()->touchup(touch); } } @end

i'm creating instance of class through code:

batouchinput * touchrecieverview = [[batouchinput alloc] initwithframe: [[uiscreen mainscreen] applicationframe]]; [[[uiapplication sharedapplication] keywindow] addsubview: touchrecieverview];

you may need set value of multipletouchenabled property of view yes (the default value of property no).

multi-touch objective-c++

No comments:

Post a Comment