Hello evryone I am working on iphone app which is showing first screen with animation using 3 images then going to other screens . Now from anywhere from the app if I closed the app and reopend it it should show the same animation then should go to screen where it stops . Is it possible without maintaining the status of app when it moving to background Thanks everyone.
Asked
Active
Viewed 181 times
1
-
I hate apps which have these animations between background switches. On start up is fine, but switching it's just irritating. – Jonathan. Jan 29 '11 at 12:48
-
yes but its a requirement because once the app laoded and running he can't see the animation if it is important – ratnasomu Jan 29 '11 at 13:41
2 Answers
2
You might want to have a look here. You could use the - (void)applicationDidBecomeActive:(UIApplication *)application
- method to display your animation on top of the active view, for example in a modal view controller or by adding it to the active view and removing it after the animation.

Philipp
- 1,903
- 2
- 24
- 33
-
Philipp: Thanks for your response , I am using tht method but do u know where can I add animation – ratnasomu Jan 29 '11 at 11:19
-
You need a reference to a visible view controller. For example, if you have a navigation-based application, you could use the outlet of your delegate to the UINavigationController to get the active uiviewcontroller. Use the presentModalViewController:Animated:- method or the addSubView: - method on that controller to display your animation and dismiss the modalviewcontroller / remove the view from its superview after the animation has finished. – Philipp Jan 29 '11 at 11:31
0
For this purpose you need to prevent app to run from background (This is inbuilt feature provided by apple in 4.0 and above.).use this link for shortout your problem.

Ishu
- 12,797
- 5
- 35
- 51
-
-
@Ishu :Thanks for your response , but I need the app to run in the background – ratnasomu Jan 29 '11 at 11:08
-
1@Aurum : Hi Aurum : Thanks for your response where is the link to your answer – ratnasomu Jan 29 '11 at 11:10
-
I was about to post it, then Phillipp K. Jaquet posted what I was going to. I figure I'll let him grab the rep, since he's just starting. – Aurum Aquila Jan 29 '11 at 11:12
-
@Aurum : oh ok .. I know that method will call when we are coming from background but where can I add imageView ? I mean how can I know which is active view – ratnasomu Jan 29 '11 at 11:18
-
You can use the `viewWillAppear` method that is in every subclass of UIViewController. – Aurum Aquila Jan 29 '11 at 11:22
-
@Aurum : viewWillAppear ? you mean to say that using a bool variable to know its coming from background then in viewWillAppear add animation ? – ratnasomu Jan 29 '11 at 11:25
-
@Aurum : But If I'm not wrong , when we r coming from background viewWillAppear will not active for current Controller – ratnasomu Jan 29 '11 at 11:26
-
Just try it out. If it doesn't work, then you can use NSNotificationCenter and post a notification that gets received by every view controller. Or you can set your app up so that a particular view gets shown every time it's opened. – Aurum Aquila Jan 29 '11 at 11:35
-
@Philip jaquet , @Aurum : Thanks . I am using the same way like using a bool variable calling the class which runs animation and using the same bool variable dismisses the class or continueing the normal flow (If its not from the background). Its working well but in middle of the app some classes using presentModalViewController to get flip the view horizontally . so if I come from tht screen self.navigationController presentModalViewController... is not working .. so how can I solve this .. otherwise is there anyway to flip the view horizontally without using presentModalViewController – ratnasomu Jan 29 '11 at 14:01
-
You could use transitionWithView:duration:options:animations:completion: , see this page for more information: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html – Philipp Jan 29 '11 at 14:05
-
No luck with this .. do u want me to use this before pushing the view using navigationController ?.. I want the transition UIModalTransitionStyleFlipHorizontal which rounds the current view to show the next view – ratnasomu Jan 29 '11 at 14:16
-
You might want to look at this: http://stackoverflow.com/questions/843534/flip-view-iphone/843564#843564 – Philipp Jan 29 '11 at 14:25
-
I need to push the viewController with navigationController which gives me same effect like flip horizontally .. there in ur ex. its adding the view right – ratnasomu Jan 29 '11 at 14:31
-
Finally how I am doing is using presentModalViewController to flip the view which leads to info view but storing the info viewController object in AppDelegate's object then while going background dismising the ViewController so that after animation it goes to the screen which is before info screen . Works fine . But randomly when app enters into foreground its showing info screen for a while .. dnt knw y its happen – ratnasomu Feb 01 '11 at 09:17