ios - Why can't I drag images? -
i working off of http://www.raywenderlich.com/33806/how-to-make-a-letterword-game-with-uikit-part-2 , , says in reference view add following implementation:
int _xoffset, _yoffset;
for initializer:
self.userinteractionenabled = yes;
it gives 3 methods implement handle dragging:
#pragma mark - dragging tile -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event { cgpoint pt = [[touches anyobject] locationinview:self.superview]; _xoffset = pt.x - self.center.x; _yoffset = pt.y - self.center.y; } -(void)touchesmoved:(nsset *)touches withevent:(uievent *)event { cgpoint pt = [[touches anyobject] locationinview:self.superview]; self.center = cgpointmake(pt.x - _xoffset, pt.y - _yoffset); } -(void)touchesended:(nsset *)touches withevent:(uievent *)event { [self touchesmoved:touches withevent:event]; }
nothing seems happen, though, when touch 1 of images , try drag around. seems never move.
there more work do; want specific based on dragged image dropped. right i'm working on smoke test, , cannot see change in ui behavior before when added code.
thanks help,
Comments
Post a Comment