Pergunta

Wich is the best way to move a UIView. I have a custom UIView with some custom things in it, like shadows, labels etc.

Today I'm using, for 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; 
    }
}

Is this the best way to move a UIView? I experience this a bit laggy.

Foi útil?

Solução

I usually reposition a view using the offset between the touchesBegan location and the touchesMoves location.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top