FlipView Transition - iphone

I'm currently designing an app that pulls map data from a service and renders them as pins on the MKMapView. In addition, my application has been designed using storyboards where each scene is embedded within a navigation controller. The feature I'm working on requires me to give the user the ability to toggle between a map view and table view for a given result set. To provide this functionality I've included a bar button item in the toolBar which (when pressed) should flip the current view out and a second view in.
So far I've been trying to the following code but to no avail:
MapListViewController *map = [[MapListViewController alloc]init];
[UIView beginAnimations:#"flip animation" context:nil];
[UIView setAnimationDuration:3.0];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:map.view cache:YES];
[self.mapView removeFromSuperview];
[self.view addSubview:map.view];
[UIView commitAnimations];
I originally got this approach from here but it doesn't seem to be working for me.
A couple more things to note:
The flip view transition should only change the view currently displayed within the top and bottom navigation bars.
Presenting the new view modally isn't an option because I will lose site of my navigation controller.
The view/view controller responsible for displaying the result set in a list format (i.e. UITableView) is contained within a single xib file where as the rest of the application sits within a storyboard.
Question
What is wrong with my current implementation? How should it be modified?

I haven't used your method but I did implement flipping some views using a UIView class method. It was very easy and straightforward. Refer to the docs for other options.
[UIView transitionFromView:self.firstVC.view toView:self.secondVC.view duration:1.0 options:UIViewAnimationOptionTransitionFlipFromLeft completion:^(BOOL finished) {
// add any completion code here if needed.
}];

Check this links may help you
Flip View Iphone
how to implement an iPhone view transition animation with both flipping and scaling?
Hope it helps you . Thanks!!

Hi implementing some thing like this should help you
To Push use this..
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[navigationController pushViewController:viewController animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:navigationController.view cache:NO];
[UIView commitAnimations];
For Pop use this
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[navigationController popViewControllerAnimated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:navigationController.view cache:NO];
[UIView commitAnimations];

Related

Performing code right before dismissing a partial curl through touching on the curl itself

I'm using Storyboards for a modal segue with a partial curl effect. Input fields are on the bottom, so if the keyboard is shown, it is necessary to translate the screen with:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.25];
self.view.superview.center = CGPointMake(self.view.center.x, [[UIScreen mainScreen] bounds].size.height/2 - 200);
[UIView commitAnimations];
After its job is done, the finishing IBAction undoes the translation before dismissing the modal view:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
self.view.superview.center = CGPointMake(self.view.center.x, [[UIScreen mainScreen] bounds].size.height/2);
[UIView commitAnimations];
...
[self dismissViewControllerAnimated:YES completion:nil];
Everything alright with this but there remains the following problem: The user can always touch the opened curl to dismiss the view. If this is done while the keyboard is shown and therewith the screen is translated, the screen flickers shortly and an abnormal program behaviour is the result. I either need to deactivate the click-on-curl-to-dismiss-the-view or I have to perform the back translation before the curl dismisses. Neither using textFieldShouldReturn to resign the first responder nor performing the back translation in viewWillDisappear/viewDidDisappear (which should in theory performed right before the dismiss?) have any effect. Does someone has any hint for me?
Create a protocol / delegate on your destination modal view then call back to your presenting viewController so your translation is handled properly once the view dismisses in the viewWillDisappear method.
Here are some examples of delegates

Animate a UIButton from one image to another

I noticed in the Jamie Oliver app, when you click one of the buttons, it goes from one size to another in a smooth transition. Does anyone know how this is done? I tried using some of the UIView animations, but none of them satisfies my needs.
UIAnimations alone can not give you that effect.. You need to couple them with transformations to achieve the effect that you are talking about. Try it in the following way. You will get what you need...
[UIView beginAnimations:#"Zoomin" context:nil];
[UIView setAnimationDuration:0.25];
starImage.transform=CGAffineTransformMakeScale(2.5, 2.5);
[UIView commitAnimations];
[UIView beginAnimations:#"Zoomout" context:nil];
[UIView setAnimationDuration:0.25];
starImage.transform=CGAffineTransformMakeScale(1, 1);
[UIView commitAnimations];
I believe animation blocks are the preferred method for animating views now.

iPhone UIActivityIndicatorView While Loading UIViewController

I've an application with a UITabBarController with five tabs.
Tests on real device show that switching from a tab to another, may take one or more seconds to load the views, because I also have to download some data from the Internet.
What I would like to do is to show a UIActivityIndicatorView while the view is loading, but I couldn't find a solution. Maybe I haven't searched the right way.
Could someone help me?
You should download any data with an asynchronous request, ASIHTTPRequest is a nice wrapper for this.
Then for the UIActivityIndicatorView these are popular options:
Show it on the tab, BEFORE actually
loading anything else in the view.
And when the data is ready just hide
it and show the complete info.
Show your incomplete view, and add
an overlay with the
UIActivityIndicatorView.
The way I do it :
Create a LoadingViewController Class with a UILabel, a UIActivityIndicator and black background .
In the ViewDidLoad method, i set :
[self.view setAlpha:0.0];
[self.activityIndicator startAnimating];
I implement two methods :
-(void)appear{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[self.view setAlpha:0.65];
[UIView commitAnimations];
}
-(void)disappear{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[self.view setAlpha:0.0];
[UIView commitAnimations];
}
In the label you can set a custom text.
Import this class in the class you are working on and just call :
[loadingViewController appear];
and
[loadingViewController disappear];
I don't have a Mac with me right now and can't verify if i just wrote any mistakes but I hope you get the idea :)
I always prefer to make a custom class for this in case I'll need it at many places in my app.

iPhone animations - animating one things causes other things to be animated

I've animated moving a UIView as follows:
CGRect rightPop = CGRectMake(167, 270, 142, 73);
[UIView beginAnimations:nil context:NULL];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.4];
[rightToast setFrame:rightPop];
[UIView commitAnimations];
The animation occurs just fine, but it causes other parts of the app to become animated (eg, navigation bars etc).
Does anyone know how I can stop the other animations?
It's happening because animation blocks can be nested. You're opening two of them via beginAnimations, but only closing one via commitAnimations. The second animation block is still open, so extra animations are not surprising. I don't know why you're calling beginAnimations twice, it's not necessary. Drop that and things should work normally.

Calling the same Viewcontroller file from within the file itself

The following segment of code opens a new page "ScreenA" with a animation motion:
ScreenA *Acca = [ScreenA alloc];
[UIView beginAnimations:#"flipping view" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown
forView:self.view cache:YES];
[self.view addSubview:Acca.view];
[UIView commitAnimations];
It works fine but what if the call is to the page itself, meaning the file is ScreenA and I am calling the file to open again with different values to variables imbedded in the code of the file. When a call is made to a page even if it is to itself is all the memory released or is there a potential for a rescursive call that takes place building a stack of pages that will eventually crash the phone?
Really appreciate any help you might give me.
Thanks
I am just showing a code snippet to ask the bigger question about a screen calling itself. Please reconsider for an answer.