图片跟随双指捏合的距离放大或者缩小。
利用-(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);
如对本文有疑问, 点击进行留言回复!!
Codeforces Round #657 (Div. 2) C题
hdu2222 Keywords Search(ac自动机模板-kuangbin)
IOS开发控件视图day08:监听文本框状态设置按钮状态不可点击且变灰
网友评论