开发者

UIView movement

开发者 https://www.devze.com 2023-01-29 21:31 出处:网络
Which is the best way to move a UIView. I have a custom UIView with some custom things in it, like shadows, labelsetc.

Which 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 *touc开发者_Python百科h = [[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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消