Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sujithkrishnan

macrumors 6502
Original poster
May 9, 2008
265
0
Bangalore
Hi all..

I am making use of the following code in my iphone app to make an animation of the particular view.
This code works pretty good in viewDidAppear method, but not in viewWillAppear method and loadView method , Why so???

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:.75];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
[UIView commitAnimations];

Also i want to display the view with animation, here what happen is that the view will appear and then go for an animation.




The app what i am trying to developing should lokks like each views are each side of a cube...

help me!!!!
thanks..
 

Sayer

macrumors 6502a
Jan 4, 2002
981
0
Austin, TX
The viewWillAppear method and loadView method are to let your program setup any objects or data you need before the view is shown.

There is a lot of really helpful sample code from Apple that covers all of the basic tasks for making a new iPhone program.

This one deals with transitioning views:

http://developer.apple.com/iphone/library/samplecode/ViewTransitions/index.html

Part of the learning Cocoa is learning where you insert your own code on top of the framework to do something different for your program. In Apple's sample code they create a custom subclass of the UIView and use that to manage transitions to other subviews.

Once you understand that you are simply adding a few custom pieces to the existing large frameworks in iPhone OS X you will more easily figure out how to make your iPhone program (or Mac cocoa program).
 

tacoman667

macrumors regular
Mar 27, 2008
143
0
viewDidAppear is basically after all objects and instances have been allocated and initialized for that view and right before it "releases" the view to be seen in the UI, it fires off one last event handler.

The other 2 are before and during events. Those are probably not working as well/not at all because the objects you are relying on probably are not completely initialized yet.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.