<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Move an Image with Animation</title>
	<atom:link href="http://MobileDeveloperTips.com/user-interface/move-an-image-with-animation.html/feed" rel="self" type="application/rss+xml" />
	<link>http://MobileDeveloperTips.com/user-interface/move-an-image-with-animation.html</link>
	<description>iOS and Objective-C Tips, Tricks and Tutorials.</description>
	<lastBuildDate>Tue, 22 May 2012 11:53:47 -0500</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: John Muchow</title>
		<link>http://MobileDeveloperTips.com/user-interface/move-an-image-with-animation.html#comment-68678</link>
		<dc:creator>John Muchow</dc:creator>
		<pubDate>Tue, 20 Mar 2012 12:29:55 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3876#comment-68678</guid>
		<description>Thanks Mike!</description>
		<content:encoded><![CDATA[<p>Thanks Mike!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Schoonover</title>
		<link>http://MobileDeveloperTips.com/user-interface/move-an-image-with-animation.html#comment-68656</link>
		<dc:creator>Mike Schoonover</dc:creator>
		<pubDate>Tue, 20 Mar 2012 06:25:24 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3876#comment-68656</guid>
		<description>Apple now recommends using block-based animation instead.  Here is the function updated to use block animation:

- (void)moveImage:(UIImageView *)image duration:(NSTimeInterval)duration
            curve:(int)curve x:(CGFloat)x y:(CGFloat)y
{
    
    // the transform matrix
    CGAffineTransform transform = CGAffineTransformMakeTranslation(x, y);
    
    [UIView animateWithDuration:3.0 
            delay:1.0 
            options:UIViewAnimationOptionCurveEaseInOut
            animations:^{
            
            image.transform = transform;               
                
            }
            completion:nil];
    
}</description>
		<content:encoded><![CDATA[<p>Apple now recommends using block-based animation instead.  Here is the function updated to use block animation:</p>
<p>- (void)moveImage:(UIImageView *)image duration:(NSTimeInterval)duration<br />
            curve:(int)curve x:(CGFloat)x y:(CGFloat)y<br />
{</p>
<p>    // the transform matrix<br />
    CGAffineTransform transform = CGAffineTransformMakeTranslation(x, y);</p>
<p>    [UIView animateWithDuration:3.0<br />
            delay:1.0<br />
            options:UIViewAnimationOptionCurveEaseInOut<br />
            animations:^{</p>
<p>            image.transform = transform;               </p>
<p>            }<br />
            completion:nil];</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luca</title>
		<link>http://MobileDeveloperTips.com/user-interface/move-an-image-with-animation.html#comment-45897</link>
		<dc:creator>Luca</dc:creator>
		<pubDate>Thu, 07 Apr 2011 15:46:23 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3876#comment-45897</guid>
		<description>Gooooood Work Thax…………</description>
		<content:encoded><![CDATA[<p>Gooooood Work Thax…………</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arun Kumar</title>
		<link>http://MobileDeveloperTips.com/user-interface/move-an-image-with-animation.html#comment-44570</link>
		<dc:creator>Arun Kumar</dc:creator>
		<pubDate>Wed, 23 Mar 2011 10:44:45 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3876#comment-44570</guid>
		<description>Gooooood Work Thax............</description>
		<content:encoded><![CDATA[<p>Gooooood Work Thax&#8230;&#8230;&#8230;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nishant</title>
		<link>http://MobileDeveloperTips.com/user-interface/move-an-image-with-animation.html#comment-42413</link>
		<dc:creator>nishant</dc:creator>
		<pubDate>Tue, 01 Mar 2011 10:54:54 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3876#comment-42413</guid>
		<description>Hi frnzz great news! finally i found another one easy way to move UIImageView by finger touch event.

Here is the line of code:

In .h declare 

UIImageView *imageToMove;

In .m

- (void)viewDidLoad {
	
	imageToMove = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@&quot;Square.png&quot;]];
	imageToMove.frame = CGRectMake(10, 10, 20, 100);
	[self.view addSubview:imageToMove];

        [super viewDidLoad];
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
	UITouch *touch = [touches anyObject];
   	CGPoint location = [touch locationInView:self.view];
	imageToMove.center = location;
}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
     [self touchesBegan:touches withEvent:event];
}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
	
}</description>
		<content:encoded><![CDATA[<p>Hi frnzz great news! finally i found another one easy way to move UIImageView by finger touch event.</p>
<p>Here is the line of code:</p>
<p>In .h declare </p>
<p>UIImageView *imageToMove;</p>
<p>In .m</p>
<p>- (void)viewDidLoad {</p>
<p>	imageToMove = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Square.png"]];<br />
	imageToMove.frame = CGRectMake(10, 10, 20, 100);<br />
	[self.view addSubview:imageToMove];</p>
<p>        [super viewDidLoad];<br />
}</p>
<p>-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event<br />
{<br />
	UITouch *touch = [touches anyObject];<br />
   	CGPoint location = [touch locationInView:self.view];<br />
	imageToMove.center = location;<br />
}</p>
<p>-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event<br />
{<br />
     [self touchesBegan:touches withEvent:event];<br />
}</p>
<p>-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event<br />
{</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JFA</title>
		<link>http://MobileDeveloperTips.com/user-interface/move-an-image-with-animation.html#comment-34300</link>
		<dc:creator>JFA</dc:creator>
		<pubDate>Thu, 16 Dec 2010 00:35:24 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3876#comment-34300</guid>
		<description>Hi guys I&#039;d like to let the image make multiple steps, or a parabolic curve

so I tried to add more lines to the call of the moveImage method, like in the code below
but it doesn&#039;t work, in the simulator I only see the last step of the motion, not the two steps.
Why ?


- (void)viewDidLoad {
    [super viewDidLoad];
 
	
	// DEFINES IMAGE
	UIImageView *imageToMove = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@&quot;bomb50.png&quot;]];
	// START COORDINATES AND DIMENSIONS (starts from x:0,y:0)
	imageToMove.frame = CGRectMake(0, 0, 50, 50);
	// ADDS IMAGE TO THE MAIN VIEW
	[self.view addSubview:imageToMove];
 
	
	// CALLS THE moveImage METHOD 
	[self moveImage:imageToMove duration:2.0 
			  curve:UIViewAnimationCurveLinear x:50.0 y:50.0];
	
	// CALLS THE moveImage METHOD AGAIN TO PERFORM ANOTHER STEP
	[self moveImage:imageToMove duration:2.0 
			  curve:UIViewAnimationCurveLinear x:100.0 y:100.0];
		
}


i only see the second step of the animation

can anybody help ???
thanks</description>
		<content:encoded><![CDATA[<p>Hi guys I&#8217;d like to let the image make multiple steps, or a parabolic curve</p>
<p>so I tried to add more lines to the call of the moveImage method, like in the code below<br />
but it doesn&#8217;t work, in the simulator I only see the last step of the motion, not the two steps.<br />
Why ?</p>
<p>- (void)viewDidLoad {<br />
    [super viewDidLoad];</p>
<p>	// DEFINES IMAGE<br />
	UIImageView *imageToMove = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bomb50.png"]];<br />
	// START COORDINATES AND DIMENSIONS (starts from x:0,y:0)<br />
	imageToMove.frame = CGRectMake(0, 0, 50, 50);<br />
	// ADDS IMAGE TO THE MAIN VIEW<br />
	[self.view addSubview:imageToMove];</p>
<p>	// CALLS THE moveImage METHOD<br />
	[self moveImage:imageToMove duration:2.0<br />
			  curve:UIViewAnimationCurveLinear x:50.0 y:50.0];</p>
<p>	// CALLS THE moveImage METHOD AGAIN TO PERFORM ANOTHER STEP<br />
	[self moveImage:imageToMove duration:2.0<br />
			  curve:UIViewAnimationCurveLinear x:100.0 y:100.0];</p>
<p>}</p>
<p>i only see the second step of the animation</p>
<p>can anybody help ???<br />
thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://MobileDeveloperTips.com/user-interface/move-an-image-with-animation.html#comment-23396</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Thu, 12 Aug 2010 17:17:53 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3876#comment-23396</guid>
		<description>Excellently written method, works beautifully. Thanks a lot dude!</description>
		<content:encoded><![CDATA[<p>Excellently written method, works beautifully. Thanks a lot dude!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JK</title>
		<link>http://MobileDeveloperTips.com/user-interface/move-an-image-with-animation.html#comment-5410</link>
		<dc:creator>JK</dc:creator>
		<pubDate>Fri, 02 Oct 2009 17:17:47 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3876#comment-5410</guid>
		<description>Great Post. Just what I was Looking for.</description>
		<content:encoded><![CDATA[<p>Great Post. Just what I was Looking for.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

