Detecting touches on UITableView in iphone sdk
i want to animate image when the user press the cell's but开发者_JS百科tton, i created buttons at the end of each cell, when the user press the button then the image animation start from that button, what will i do?, I have used touch begin function, but it does'nt work on tableview.....I want to get x,y position of the touch on the tableview cell's button.
You can use didSelectRowAtIndexPath:
if you are using button then you can addTarget to that button and do the task in the method registered for that button.Whats the need of using touches began if you are using button? For getting x and y you already have the x y position of the button, use that
Try calling the animation in different Thread.
[NSThread detachNewThreadSelector:@selector(startAnimating) toTarget:self withObject:nil];
I think you can add target to each button when you are creating cells means in cellForRowAtIndexPath and you can get x and y for that buttton when pressed in that action-
(UIButton*)sender.frame.origion.x
and
(UIButton*)sender.frame.origion.y
NSSet *touches = [event allTouches];
UITouch *touch = [touches anyObject];
CGPoint currentTouchPosition = [touch locationInView:self.view];
CGPoint xLocation;
xLocation = CGPointMake(currentTouchPosition.x-35,currentTouchPosition.y-10);
pressPoint = xLocation;
精彩评论