ios 双指捏合放大缩小图片的例子
2013-06-25 15:09
246 查看
图片跟随双指捏合的距离放大或者缩小。
利用-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 实现。
touchesMoved每当手指在屏幕上移动的时候都会运行。
1.检测手指的个数
NSArray * touchesArr=[[event allTouches] allObjects];
NSLog(@"手指个数%d",[touchesArr count]);
2.检测两指的坐标,从而计算两指的距离。
p1=[[touchesArr objectAtIndex:0] locationInView:self.view];
p2=[[touchesArr objectAtIndex:1] locationInView:self.view];
3.计算距离增加,则增大图片,距离减小则缩小图片。用imageview的frame来控制图片的大小。
imageView.frame=CGRectMake(imgFrame.origin.x-addwidth/2.0f, imgFrame.origin.y-addheight/2.0f, imgFrame.size.width, imgFrame.size.height);
利用-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 实现。
touchesMoved每当手指在屏幕上移动的时候都会运行。
1.检测手指的个数
NSArray * touchesArr=[[event allTouches] allObjects];
NSLog(@"手指个数%d",[touchesArr count]);
2.检测两指的坐标,从而计算两指的距离。
p1=[[touchesArr objectAtIndex:0] locationInView:self.view];
p2=[[touchesArr objectAtIndex:1] locationInView:self.view];
3.计算距离增加,则增大图片,距离减小则缩小图片。用imageview的frame来控制图片的大小。
imageView.frame=CGRectMake(imgFrame.origin.x-addwidth/2.0f, imgFrame.origin.y-addheight/2.0f, imgFrame.size.width, imgFrame.size.height);
相关文章推荐
- ios 双指捏合放大缩小图片的例子
- iOS 滑动浏览图片 捏合缩小放大 音量线控
- iOS 图片捏合放大缩小 点击放大缩小
- iOS-实现图片的捏合放大与缩小
- IOS 图片放大缩小移动,使用block精简代码
- iPhone相册,(UIScrollView,UIPageControl的综合应用)捏合放大缩小, 左右滑动切换图片
- UIScrollView下对图片捏合放大缩小和双击放大缩小
- UIScrollView下对图片捏合放大缩小和双击放大缩小
- iOS小效果(2)按钮控制图片的放大缩小
- ios 根据手势放大或缩小图片
- NT_iOS笔记—iOS图片显示1_图片放大缩小
- iOS开发中,点击放大、缩小图片方法举例
- ios 图片拖拽,捏,双击放大缩小,以及保存到相册
- iOS scrollview实现图片放大和缩小的功能
- iOS 坐标转换,tableViewCell图片点击放大缩小回原位 —— HERO博客
- ios 图片拖拽,捏,双击放大缩小
- UIScrollView下对图片捏合放大缩小和双击放大缩小
- ios 根据手势放大或缩小图片
- hammer使用: 代码:捏合、捏开、图片放大 的一个手机图片“放大缩小可拖动”的小效果
- iOS点击图片放大 再点击缩小