Calling the same Viewcontroller file from within the file itself - iphone

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.

Related

UIView animation like speech bubble

i am developing a app and it has this button call menu. When i click that button it addsubview the menu view to the main view. But I need to add it like comming out from the button. Like speech bubble.
Here is a sample image i take from some iphone app and they did awesome job to animate the view, like a bubble come out from button.
this is the app i am talking about which is having the animation i mentioning.
Download Waze App from here
if you are using iphone, download it and take a look at it. Then you will get proper idea about how that animation happening. Its a free app btw.
I search through the net to find a solution for this but i couldn't find any thing helpful. There are some ideas to do it like scalling the subview, using following code. I tried it with some view animations, it has some progress but not good enough.
CGAffineTransform transform = CGAffineTransformMakeScale(1.2, 1.2);
But I am pretty sure that is not the correct way to do it. There should be a proper way to do it.
Can any one give me help me to over come this issue.
Thanks in Advance
In my project I have used the following code for animating from left to right. Changing the value for CGAffineTransform (x and y position) will provide variations. Hope this would help you!
[self.view addSubview:subView];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.0];
CGAffineTransform t2 = CGAffineTransformMakeTranslation(SubView_Width, 0);
subView.transform = t2;
subView.alpha = 1;
[UIView commitAnimations];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationDelegate:self];
subView.alpha = 1;
subView.transform = CGAffineTransformIdentity;
[UIView commitAnimations];
you need this - popover for iPhone, http://mobiledevelopertips.com/open-source/ios-open-source-popover-api-for-iphone-wepopover.html

FlipView Transition

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];

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.