我有一个视图,当我单击它时,它会左右移动。我只得到视图的点中心。我怎样才能在锚点上获得 uiview,因为无论我点击哪个视图,它都会移动。
这是我的代码:
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"touchesMoved called");
UITouch *touch = [[event allTouches] anyObject];
CGPoint touchpoint=[touch locationInView:self.view];
if ([touch view]==secondView)
{
secondView.center=touchpoint;
[self animateFirstPoint:[touch view]];
}
}