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中UIView的layoutSubviews子视图布局方法使用
- iOS应用开发中UIView添加边框颜色及设置圆角边框的方法
- CALayer与UIView的关系
- UIView的bounds和frame区别
- uiview
- uiview生命周期
- UIView翻译 (参考)
- iOS 转变UIView到UIImage
- UIView动画
- initWithFrame 和 initWithCoder
- [CS193P] 第六堂課摘要及心得筆記
- UI第一天
- 棋盘
- ios实现button变换颜色并可以放大、缩小、旋转
- uiview contentViewmode
- iphone开发小记 基础知识2
- iphone开发小记 基础知识3
- [笔记]I 群聊天记录2012/03/中
- iPhone开发进阶(2) --- iPhone应用程序/项目的构成
- 视图弹出后放大又缩小的动画实现、类似于alertView效果