效果是那种鼠标触屏 、移动时 ,总有图片跟着走,这种用了什么技术啊,谢谢大家!!
解决方案 »
- IPhone通讯录的“联系人”界面 制作
- VM虚拟Mac安装Xcode和iOS SDK出现N种问题,详情见下文
- 关于cell已选标记不消失问题
- 想要成为iOS 架构师的得看看这个!
- 把第二页的值传到第一个页面,从而改变areaButton的title,但是值传不过来,请问哪里出问题了
- 刚切入到UITabBarController只显示第一个按钮
- 字母数字混合排序
- iOS 怎样实现这样的效果
- Xcode 10 iOS12 "A valid provisioning profile for this executable was not found."
- ios的fopen,fwrite,fclose三个函数太慢
- 求助!关于百度地图轨迹回放功能的实现
- 跪求IOS方面Iphone、Ipad等方面视频
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
lastTouch = [touch locationInView:self];
if (shapeType == kImageShape) {
CGFloat horizontalOffset = drawImage.size.width / 2;
CGFloat verticalOffset = drawImage.size.height / 2;
redrawRect = CGRectUnion(redrawRect,
CGRectMake(lastTouch.x - horizontalOffset,
lastTouch.y - verticalOffset,
drawImage.size.width,
drawImage.size.height));
}
else
redrawRect = CGRectUnion(redrawRect, self.currentRect);
redrawRect = CGRectInset(redrawRect, -2.0, -2.0);
[self setNeedsDisplayInRect:redrawRect];
}- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
lastTouch = [touch locationInView:self];
if (shapeType == kImageShape) {
CGFloat horizontalOffset = drawImage.size.width / 2;
CGFloat verticalOffset = drawImage.size.height / 2;
redrawRect = CGRectUnion(redrawRect,
CGRectMake(lastTouch.x - horizontalOffset,
lastTouch.y - verticalOffset,
drawImage.size.width,
drawImage.size.height));
}
redrawRect = CGRectUnion(redrawRect, self.currentRect);
[self setNeedsDisplayInRect:redrawRect];
}
{
//获取触摸点位置
CGPoint touchLocation = [self convertTouchToNodeSpace:touch];
//获取上一个触摸点位置
CGPoint oldTouchLocation = [touch previousLocationInView:touch.view];
oldTouchLocation = [[CCDirector sharedDirector] convertToGL:oldTouchLocation];
oldTouchLocation = [self convertToNodeSpace:oldTouchLocation];
//得到两个位置之间的向量
CGPoint translation = ccpSub(touchLocation, oldTouchLocation); attackPoint = touchLocation;
//touchLocation = [[CCDirector sharedDirector] convertToGL:touchLocation];
if (selmagic.magiccdend)
{
selmagic.magic_ring.opacity = 250;
canmagic = YES;
//移动后的触点位置
CGPoint newPos = ccpAdd(selmagic.magic_ring.position, translation);
//让释放魔法可移动精灵随触点移动
selmagic.magic_ring.position = newPos;
}
}
按照这个方法写就可以了