开发者

UIView smooth moving

开发者 https://www.devze.com 2023-02-14 02:26 出处:网络
If you will move some UIVi开发者_如何学运维ew object with simple code: - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{

If you will move some UIVi开发者_如何学运维ew object with simple code:

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
int stepInt = [[touches anyObject] locationInView:self].x - [[touches anyObject] previousLocationInView:self].x;
_subView.left += stepInt;}

You will see that it twitches while moving. But if you try to move some UIView object placed into UIScrollView, you will see that it's moving very smoothly. So, the question is - how UIScrollView works inside?

Thanks in advance!

0

精彩评论

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