Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-19-2011, 09:21 AM   #1 (permalink)
learner2011
 
Join Date: Mar 2011
Posts: 115
ashwinr87 is on a distinguished road
Default zoom animation using animation with block based methods in Ipad

Hi,

I have a zoom animation in which when I perform an action, a view comes up in a zooming fashion.

The code I use to do this is,
Code:
    CGFloat xpos = self.view.frame.origin.x;
    CGFloat ypos = self.view.frame.origin.y;
    popContents.view.frame = CGRectMake(xpos+100,ypos+150,5,5);
    [UIView beginAnimations:@"Zoom" context:NULL];
    [UIView setAnimationDuration:0.8];
    popContents.view.frame = CGRectMake(320, ypos-70, 350, 350);
    [UIView commitAnimations];
    [self.view.superview addSubview:popContents.view];
I just realized that in ios 4.0, usage in this fashion is not recommended and animations using block based methods is recommended..

I tried looking for any sort of example which would give me a hint to get the zooming effect I need using the block based methods but I have not been able to find any...

It would be great if anyone could help me out in this...
ashwinr87 is offline   Reply With Quote
Old 04-19-2011, 09:25 AM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

This thread has an example of how to use the blocks.
smithdale87 is offline   Reply With Quote
Old 04-19-2011, 09:29 AM   #3 (permalink)
learner2011
 
Join Date: Mar 2011
Posts: 115
ashwinr87 is on a distinguished road
Default

Thank you for the quick reply..
I kind of figured out how to use animation using block based methods.. however, I am unable to figure out where I can add the "Zoom" effect similar to the one I used.

I usually used to add this following line to get a zooming effect
Code:
    [UIView beginAnimations:@"Zoom" context:NULL];
however in the animate using blocks I am not able to find out where to add this effect..

Quote:
Originally Posted by smithdale87 View Post
This thread has an example of how to use the blocks.
ashwinr87 is offline   Reply With Quote
Old 04-19-2011, 09:32 AM   #4 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

this should help
Creating Basic Animations on iPhone | Switch on the Code
__________________
dany_dev is offline   Reply With Quote
Old 04-19-2011, 09:37 AM   #5 (permalink)
learner2011
 
Join Date: Mar 2011
Posts: 115
ashwinr87 is on a distinguished road
Default

Thank you for the link..
The problem is the way they are creating the animation is not recommended in Ios 4.0 and it is said that that type of coding will be depreciated soon...
The recommended way is to use animation with block based methods similar to the link that smithdale87 posted but I would like to know how to add the zooming effect...

Quote:
Originally Posted by dany_dev View Post
ashwinr87 is offline   Reply With Quote
Old 04-19-2011, 11:42 AM   #6 (permalink)
learner2011
 
Join Date: Mar 2011
Posts: 115
ashwinr87 is on a distinguished road
Default

I figured it out...

Apparently "zoom" is just a name and does not do anything( as far as I experimented with it)

Here is how I achieve the effect using animate with block based methods...

Code:
[UIView animateWithDuration:0.8 animations:^ { popContents.view.frame = CGRectMake(160, 70, 350, 350);
			[self.view.superview bringSubviewToFront:self.view];
			[self.view.superview addSubview:popContents.view]; }
						 completion: ^(BOOL finished) {
							 NSLog(@"DONE");
						 }
		 ];
If I am wrong, please feel free to correct me...
ashwinr87 is offline   Reply With Quote
Old 04-19-2011, 12:01 PM   #7 (permalink)
learner2011
 
Join Date: Mar 2011
Posts: 115
ashwinr87 is on a distinguished road
Default

I have another question regarding the "options:" value.. say If I had written the following code,
Code:
[UIView animateWithDuration:0.8 delay:0.0 options: UIViewAnimationTransitionFlipFromLeft animations:^ { popContents.view.frame = CGRectMake(160, 70, 350, 350);
			[self.view.superview bringSubviewToFront:self.view];
			[self.view.superview addSubview:popContents.view]; }
						 completion: ^(BOOL finished) {
							 NSLog(@"DONE");
						 }
		 ];
I thought
Code:
options:UIViewAnimationTransitionFlipFromLeft
would have additional effect on my animation in addition to the zooming effect.. whatever value I give for the options: does not seem to affect my animations..

Would someone be able to help me out in this?
ashwinr87 is offline   Reply With Quote
Old 04-20-2011, 10:02 AM   #8 (permalink)
learner2011
 
Join Date: Mar 2011
Posts: 115
ashwinr87 is on a distinguished road
Default UPDATE

here is the edited code...

Code:
 [UIView transitionWithView:self.view duration:1 options:UIViewAnimationOptionTransitionFlipFromLeft 
animations:^{ popContents.view.frame = CGRectMake(160, 70, 350, 350);
[self.view.superview bringSubviewToFront:self.view];
[self.view.superview addSubview:popContents.view];
		}
completion: ^(BOOL finished) {NSLog(@"DONE");}];
so what happens here is that the table view rotates while the popContents view zooms to position.. I understand that is what will happen since I had given
Code:
 transitionWithView:self.view
however, how will I be able to add this effect to the popContents view ( the view which zooms to position)... is it possible?
I tried
Code:
transitionWithView:popContents.view
but that does not seem to have any effect...
ashwinr87 is offline   Reply With Quote
Reply

Bookmarks

Tags
animation, ios4.0, ipad, zooming

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 351
14 members and 337 guests
dansparrow, dre, ilmman, LezB44, lorrettaui53, Nobbsy, Objective Zero, oztemel, pbart, samdanielblr, shagor012, sledzeppelin, thephotographer, Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,119
Posts: 402,896
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:47 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0