I am knew to sphero ios sdk. I would like to know that how could I achieve the movement of object from one point to another in screen of my device while I moving my device from one direction to another using sphero. I have refereed "StreamingAnimation" demo project of sphero. I have also refereed other sample projects of sphero ios sdk also but I am not able to get that how could i achieve the movement of object while I am moving my device from one direction to other. Your reply would be appreciable.
Asked
Active
Viewed 501 times
1 Answers
2
Try This
am taking Image to move
UIImageView*animationImage;
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panDetected:)];
panRecognizer.delegate = self;
[animationImage addGestureRecognizer:panRecognizer];
In Method You Should Implement Like this
-(void)panDetected:(UIPanGestureRecognizer *)panRecognizer
{
CGPoint translation = [panRecognizer translationInView:self.view];
CGPoint imageViewPosition = animationImage.center;
imageViewPosition.x += translation.x;
imageViewPosition.y += translation.y;
animationImage.center = imageViewPosition;
[panRecognizer setTranslation:CGPointZero inView:self.view];
}