popviewcontroller from view 2 causes view 1 to stop animating its background - iphone

Really weird issue, i've got a view (view 2) that i'm popping to bring up my main view (view 1) which has an animated background. Once i pop from view 2, view 1 loses those animations... the weird thing is that moving the iOS status bar in the slightest will restart them!
Any ideas?
This is the code that i'm using to pop the view. If I pop the view without animations, it works fine.
-(IBAction)popOnSwipe {
[UIView beginAnimations:#"" context:nil];
[UIView setAnimationDuration:0.75];
[UIView setAnimationCurve:UIViewAnimationTransitionCurlDown];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO];
[navController popViewControllerAnimated:NO];
[UIView commitAnimations];
One more thing; the animation starts back up on the simulator, but not on the iTouch i'm testing it on. Any insight would be greatly appreciated,
thanks!

Add your animations for view1 in DidStopSelector method like,
-(IBAction)popOnSwipe
{
[UIView beginAnimations:#"" context:nil];
[UIView setAnimationDuration:0.75];
[UIView setAnimationCurve:UIViewAnimationTransitionCurlDown];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO];
[UIView setAnimationDidStopSelector:#selector(view1_animation)];//add this line
[navController popViewControllerAnimated:NO];
[UIView commitAnimations];
}
-(void)view1_animation
{
//do animations for view1
}

The device I was using was faulty, the method works fine on my other devices. Thanks for the help.

Related

uiview animation does not call after navigating back from a viewcontroller

I am Giving a uianimation with Infinite repeats in viewDidAppear: by code given below
[UIView beginAnimations:#"theAnimation" context:NULL];
[UIView setAnimationDuration:2];
[UIView setAnimationRepeatCount:FLT_MAX];
[UIView setAnimationRepeatAutoreverses:YES];
[startButton setAlpha:.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView commitAnimations];
[super viewDidAppear:YES];
but when I am navigating to some page with pushViewController and returning back to same view controller the viewDidAppear is calling but the animation is not working . and works fine when using presentViewController.Can please any one help me with it.
thanks
Try to call [super viewDidAppear:YES]; before animation code.

different type of animation in iPhone

I am new to iPhone developer,
I want to implement different Animations on button click, i have 5 Button in my home page
on each click of button, i want to navigate to a new page with different Animation so i want to know what are the different animation available in iPhone.
so far i have found only 2 animation,
(1)
[UIView beginAnimations:#"yourAnim" context:nil];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:yourView cache:cacheFlag];
...
[UIView commitAnimations];
(2)
[UIView beginAnimations:#"yourAnim" context:nil];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:yourView cache:cacheFlag];
...
[UIView commitAnimations];
Thanks In Advance !
This link provides the UIView Animation. Go through it.
http://www.raywenderlich.com/5478/uiview-animation-tutorial-practical-recipes
These are 5 different Animation Transition:
UIViewAnimationTransitionNone,
UIViewAnimationTransitionFlipFromLeft,
UIViewAnimationTransitionFlipFromRight,
UIViewAnimationTransitionCurlUp,
UIViewAnimationTransitionCurlDown,
Look at CATransition class too
https://developer.apple.com/library/mac/#documentation/graphicsimaging/reference/CATransition_class/Introduction/Introduction.html
I think bellow method from you can test different type of Transition Animation....
- (void) pushController: (UIViewController*) controller
withTransition: (UIViewAnimationTransition) transition
{
[UIView beginAnimations:nil context:NULL];
[self pushViewController:controller animated:NO];
[UIView setAnimationDuration:.5];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationTransition:transition forView:self.view cache:YES];
[UIView commitAnimations];
}
You Can Get Idea From this May Be.....

how to go one view from another view using with flip animation in iPhone

I am flip animation to go from one view to another and animation is working properly but when i am using button action on that view that time application is getting crash.
Please help me out to solve this problem.
my code is:
Abtsk1 *secondViewController = [[Abtsk1 alloc]
initWithNibName:#"Abtsk1"
bundle:nil];
[UIView beginAnimations:#"flipping view" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown
forView:[[self navigationController] view] cache:YES];
[self.view addSubview:secondViewController.view];
[UIView commitAnimations];
Thanks
Kunal

UIView setAnimationTransition is not working?

i have added one view in UIwindow as
[window addSubview:parVC.view];
i toggle the parVC.view through the following , but it is not working
- (IBAction)flipToback:(id)sender
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
forView:parVC.view
cache:YES];
[parVC.view addSubview:imgController.view];
[UIView commitAnimations];
}
I have set correctly imgController.view in IB in app delegate. I want to avoid window in forView. If i give window instead of forView:parVC.view , it works fine....
That sounds like the correct behavior to me. setAnimationTransition:forView:cache: operates on the container view, not the one you're adding.

IPhone SDK - Transition to NavigationController display problem

I am nearly finished with my first IPhone app and everything works fine - except of one very little display bug:
My starscreen is an UIView (Fullscreen) without Navigationbar or Toolbar.
If I tap on a start button, there is an UIViewAnimationTransitionFlipFromRight animation that flips to the main navigation controller:
-(IBAction) switchViewToMainMenu {
[UIView beginAnimations:#"Flip View" context:nil];
[UIView setAnimationDuration:1.25];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:self.window cache:YES];
[self.navController viewWillAppear:YES];
[self.startScreenViewController viewWillDisappear:YES];
[self.startScreenViewController.view removeFromSuperview];
[self.window addSubview:navController.view];
[self.startScreenViewController viewDidDisappear:YES];
[self.navController viewDidAppear:YES];
[UIView commitAnimations];
self.startScreenViewController=nil;
[startScreenViewController release];
}
This works fine except of one little problem:
When the navigation controller view appears (flips in), the Navigationbar on top is some pixels too high (the is a white bar where the Navigationbar should be). When the animation finished, the Navigationbar drops down to the right position. This doesn't look very beautiful...
Any ideas how to fix that problem ?
We found a solution using the setAnimationDelay giving some time the tabbar to load and placed in view.
Thought you have to alter the code a little in order to use the setAnimationDelay.
You have to use the setyanimationdelay just before the setanimationtransition and the setanimationtransition just before the commitAnimations. So the code above should end to:
[UIView setAnimationDelay:2]; // 2 seconds delay seems to be working for us
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:self.window cache:YES];
[UIView commitAnimations];