这是移动UIView的最佳方式。我有一个自定义的UIView,里面有一些自定义的东西,比如阴影,标签等等。
今天我使用move this UIView:
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
if (self.isEditing) {
CGPoint location = [touch locationInView:[rootView view]];
self.center = location;
}
}这是移动UIView的最佳方式吗?我对此有些迟钝。
发布于 2010-12-09 19:21:41
我通常使用touchesBegan位置和touchesMoves位置之间的偏移量来重新定位视图。
https://stackoverflow.com/questions/4396680
复制相似问题