0

这是移动 UIView 的最佳方式。我有一个自定义的 UIView,里面有一些自定义的东西,比如阴影、标签等。

今天我正在使用,移动这个 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 的最佳方式吗?我觉得这有点滞后。

4

1 回答 1

0

我通常使用 touchesBegan 位置和 touchesMoves 位置之间的偏移来重新定位视图。

于 2010-12-09T11:21:41.420 回答