您的位置:首页 > 产品设计 > UI/UE

IOS-UIView的移动

2016-07-05 12:17 447 查看
1.UIView的移动
- (void)initAdditionalControl
{
self.moveView = [[UIView alloc] initWithFrame:CGRectMake(100, 300, 100, 100)];
self.moveView.backgroundColor = [UIColor redColor];
[self.view addSubview:self.moveView];
}

- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint cup = [touch locationInView:self.moveView];
CGPoint bef = [touch previousLocationInView:self.moveView];
self.moveView.transform = CGAffineTransformTranslate(self.moveView.transform, cup.x - bef.x, cup.y - bef.y);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  IOS控件 IOS界面 uiview