hi to all ,
i have one code which move the uiimage on touch-event
is like this -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch=[[event allTouches]anyObject]; touchOffset= image.center.x-[touch locationInView:touch.view].x;
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch=[[event allTouches]anyObject]; //paddle movemant coordinates float distanceMoved=([touch locationInView:touch.view].x+touchOffset)- image.center.x; float newX= image.center.x+distanceMoved; if(newX>30 &&newX<290) image.center=CGPointMake(newX, image.center.y); if(newX>290) image.center=CGPointMake(290, image.center.y); if(newX<30) image.center=CGPointMake(30, image.center.y);
}
BUT the problem is that I want this action must be perform on button(left-right button)action.When ever I pressed the left button UIImage move little bit to left side. And When ever I pressed the Right button UIImage move little bit to right side basically I want image movement controller with button only on x axis of iphone or pad.
thanks in advance