作者yavis (yavis)
看板MacDev
标题[问题] pan手势判断往左滑或往右滑
时间Thu Mar 12 21:53:18 2015
又有问题来请教板上前辈,
问题如标题所示如何判断pan手势往左或往右
目前的想法是宣告了location物件取得座标x,
CGPoint location = [sender locationInView:self.view];
[sender setTranslation:location inView:self.view];
if(loaction.x - currentlocaton.x == -1)
{
NSlog("left);
}else{
NSlog("right);
}
不知道这解法是否正确,
还有想请教前辈们如何取得判断式里currentlocaton.x的值呢?
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 114.40.226.161
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/MacDev/M.1426168400.A.967.html
※ 编辑: yavis (114.40.226.161), 03/12/2015 21:58:26
1F:→ darktt: -translationInView:就可以取得移动的矢量了 03/13 06:49
2F:→ uranusjr: 「向量」 03/13 10:53