How do they make those fancy Splash screens? - iphone

Although I currently only have one app out in the App store, I have several in the works and was wondering how users are making their splash screens.
I have seen several very cool animated ones and was wondering if this was all done via code or is it just something you would make in possibly iMovie and just run it as a video.
Any idea how some of these are being created? Examples are anything from Time Warner Cables app to Bejeweled.
Thanks in advance for the info.
Geo...

See iPhone Animated Loading Screen <-- the answer in there seems to be that the "fancy" splash screens aren't actually loading screens.
So what you will have to do is to create an animation (maybe a movie clip, or an imageview animation or similar) that can be run when the app starts artifically, possibly with you loading your resources behind that, rather than using the default splash screen functionality (to speed up the start of your app).
Hope that helps

Try this in App delegate class ....
- (void)applicationDidFinishLaunching:(UIApplication *)application {
UIImage *splashImage = [UIImage imageNamed:#"Picture 2.png"];
splashImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 20, 320, 480)];
splashImageView.contentMode = UIViewContentModeScaleAspectFit;
splashImageView.image = splashImage;
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:#selector(removeSplashScreen) userInfo:nil repeats:NO];
[window addSubview:splashImageView];
}
-(void)removeSplashScreen{
[UIView beginAnimations: nil context:nil];
[UIView setAnimationDuration:2.0];
splashImageView.alpha = 0.0;
[UIView commitAnimations];
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:#selector(releaseSplashScreen) userInfo:nil repeats:NO];
}
-(void)releaseSplashScreen{
[splashImageView removeFromSuperview];
[splashImageView release];
//Load the rootviewController here
}
You can also include Default.png in the resource of the project

There's a couple chapters on custom splash screens in Drance & Warren's book 'iOS Recipies' from Pragmatic Bookshelf.
Perhaps a commercial plug isn't what you're seeking (I'm not affiliated the the title or publisher), I just remember reading through it and finding it interesting.

You can do a fancy splash screen if you made it on the first view controller, like your real splash screen is the first scene of your animation, and the first view controller is the complete animation then you dismiss the first controller or you push the main view controller after a delay from you first view controller.

Related

iOS: is it possible to attechment of MFMailComposeViewController with Animation?

I am working on attach images into MFMailComposeViewController everything is fine working but i want to know that is it Possible to give animation of Attachment?
For Ex:- When we attach images from Photo Gallery in iPhone Device. and while select mail Button that all selected Images Move's in MailComposeViewcontroller with Nice ANIMATION.
So please can any-buddy guide me this stuff is possible or not.? and if YES then how can i set Animation of Attachment.
There exists some semi-solution. You can in fact add any UIView as subview of you main app's window. It will than sit on top of all apps content. Using this you can simulate animation of attaching image to MailComposeViewcontroller
See my example code. This code slides image view from top of the screen to mail composer so it imitates adding of image as attachment. Everything is commented.
// Get apps main window
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
// Setup frames of animated image view in apps window - adjust to your needs
CGRect finalImageFrame = CGRectMake(30, 220, window.frame.size.width-60, 100);
CGRect initialImageFrame = finalImageFrame;
initialImageFrame.origin.y = -initialImageFrame.size.height;
// Create image view to be animated as attachment
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"myImage"]];
imageView.frame = initialImageFrame;
imageView.backgroundColor = [UIColor redColor];
// Add animated image view to window
[window addSubview:imageView];
// Animate image view with slide in from top
[UIView animateWithDuration:0.4
animations:^{
imageView.frame = finalImageFrame;
}];
// Present mail composer
[self presentViewController:mailComposer animated:YES completion:^{
// Once the controller appears, hide the image view - adjust this animation according to you needs
[UIView animateWithDuration:0.4
animations:^{
imageView.alpha = 0;
} completion:^(BOOL finished) {
[imageView removeFromSuperview];
}];
}];
Of course the code may need some adjustments and polishing, but it shows the concept. You can play with animations to make some better effect. There is a lot of animation tweaks I would add, but I wanted to keep the example code as short at it can be ;-)
That is iOS custom animation effects and is not exposed as iOS API's so no you cannot get this effect out of box. The reason I know that this effect is not exposed to developers is from Apple iOS 6 Docs. There is only one method which deals with animate and its the standard one.
What you can try is this. After the user has selected image(s) from his photo gallery (i.e. from ALAssetsLibrary) you can animate a "image" that looks like a MFMailComposeViewController. The animation would similar to what iOS provides i.e. background fading, MFMailComposeViewController appearing and the images sitting in the "body" section of the mail. Once the animation finishes, remove the "image" of MFMailComposeViewController and show the actual call MFMailComposeViewController invoked with animaiton:FALSE option. Hope I was clear. Essentially what you are providing is an illusion of MFMailComposeViewController and once animation is done, taking away the illusion and showing the reality.
Theoretically this could work but exact animation timing and user perceived feel has to be tested out.

Adding a splash screen to my project

I have created a project which consist of a tabbarcontroller and a navigationcontroller.
The first view or the first tab is a tableview controller. Now i need to add a splashscreen to my application, so when the app loads it will show a welcome screen and then land on the tableviewcontroller.
My workings so far;
This is added in my viewDidLoad method.
myImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"splash.jpg"]];
myImageView.frame = [[self view] frame];
[self.view addSubview:myImageView];
[self.view bringSubviewToFront:self.myImageView];
The problem is that the splash screen or the UIImageView loads inside the tabbarController/NavigationController, and it does not take the full width and length of the screen. What should i do to fix this programatically ?
In application bundle you need to copy the splash screen images with the name "Default.png" and "Default#2x.png" for Retina. The app will load this automatically, you don't need to do more work.
Here you have a link for this: http://iosdevelopertips.com/cocoa/defaultpng-the-secret-of-the-load-screen.html
Add the images that you want to use to the resources of your project and name them Default.png and Default#2x.png (if you are providing it for a retina screen). Be sure no name them exactly. If you get the capitalisation wrong, it will work in the Simulator (which is not case-sensitive), but not on the device (which is case-sensitive).
Be aware that a "splash screen" is discouraged by the Apple Human Interface Guidelines:
Have you given the Launch Images a look in your target settings?
You would probably want to add the splash screen in the app delegate's didFinishLaunchingWithOptions method. Then start an animation of fade out (or whatever animation you need). Finally removing the splash screen view when the animation is complete.
You have to add the UIImageView to the root's view:
UIView *rootView = [[[[UIApplication sharedApplication] delegate] viewController] view];
[myImageView setFrame:rootView.bounds];
[rootView addSubview:myImageView];
you can use the uiimage view to add an array of images to play an animation, try the following
code in
-(void)viewDidAppear:(BOOL)animated {
animationSplashImageView.animationImages = imageArray;
animationSplashImageView.animationDuration = 5;
animationSplashImageView.animationRepeatCount = 1;
[animationSplashImageView startAnimating];
}
IBOutlet UIImageView* animationSplashImageView;
was defined in the main view of your app.
also you could test your splash using tool Splashx Free, which is on Apple App Store: http://itunes.apple.com/cn/app/splashx-free/id500137095?mt=8

UIImageView animation lag

I have a problem with the animation. At start, everything is smooth. However, when the application runs for a certain period of time (around 10 min) then the animation lags.
Here is the code in viewDidLoad:
[NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:#selector(updateImage) userInfo:nil repeats:YES];
And in -(void)updateImage: //image fade in
[aSubview release];
[aSubview removeFromSuperview];
aSubview = [[UIImageView alloc] initWithFrame:CGRectMake(28, 64, 265, 284)];
aSubview.image = [slideShowArray objectAtIndex:randNum];
[aSubview setAlpha:0.0];
[UIImageView beginAnimations:NULL context:nil];
[UIImageView setAnimationDuration:2.0];
[aSubview setAlpha:1.0];
[UIImageView commitAnimations];
[self.view addSubview:aSubview];
UIImageView *film = [[UIImageView alloc] initWithFrame:CGRectMake(20, 34, 280, 344)];
film.image = [UIImage imageNamed:#"film5.png"];
[film setAlpha:1.0];
[self.view addSubview:film];
[film release];
Can anyone explain this? Is it due to memory issue or something else? Thanks in advance.
[self.view addSubview:aSubview];
You are adding a subview in every 3 seconds. So after 10 mins there are 200 subviews which requires too much memory and thus slowing the app. Before adding a new subview, remove the previous ones if they are not needed. And if you need 200 subviews simultaneously then you should reconsider your design.
EDIT: After the edit of the question, why do you need to add a film every time? You are adding a new film object every time the method is called. Note that, super view retains subviews. So if the method is called 20 times then you have 20 film objects in memory.
Yes, your problem is with memory aggregating over time. To solve this problem use Instruments to check memory usage and find out what causes it. You might not release some object. In XCode go to Product -> Profile or press "cmd+i" choose "Allocations" and add "Leaks" manualy. Run Instruments and try to debug your problem.
[self.view addSubview:aSubview];
The above is not the issue at all, from the apple documentation for addSubView .
Views can have only one superview. If
view already has a superview and that
view is not the receiver, this method
removes the previous superview before
making the receiver its new superview.
Animation is always a heavy operation in term of memory that need to store many thing before and after animation, which are not visualable to as application developer. And in your case you are doing it more than 10 min.. in a loop that lead to reduce the availability of memory for next animation operation.

How can I display a introduction modal view when the app start up?

I have a tab bar application and I want to display those views that most part of apps have, with the name of the company or the name of the app.
I've created the follow viewController
Introduction *introducao = [[Introduction alloc] initWithNibName:#"Introduction" bundle:nil];
I don't know where exactly should I insert the code to show the modal because I have a tab bar application:
[self.navigationController presentModalViewController:galeria animated:YES];
I've tried to insert these lines on appDelegate.. but didn't work.. somebody have an idea?
if you are trying to show a splash screen right when the application opens, you should use a Default.png image instead of a view controller showing an image. Check out the Apple Documentation on Human Interface Guidelines and Beginning iPhone Development.
First of all, you'll need to ensure that you have a navigation controller present to present the model view from. Otherwise in the above code you'll be messaging nil and nothing will happen. Then you'll want to put the presentModalViewController:animated: call in your app delegate's applicationDidFinishLaunching: implementation.
Thanks for all answers.. they were very useful to understand better the process..
I have found a solution that does exactly what I need! So if someone need to create those splash screens with a sequence of images it is very useful:
Just create a ImageView on the Delegates Header and do the following:
splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
splashView.image = [UIImage imageNamed:#"Default.png"];
[window addSubview:splashView];
[window bringSubviewToFront:splashView];
to control the duration of the splash screen:
[self performSelector:#selector(removeSplash) withObject:nil afterDelay:1.5];
To remove the splash:
-(void)removeSplash;
{
[splashView removeFromSuperview];
[splashView release];
}
so If you want to create a sequence of image just create a method to change the splashView.image.. and create a NSTIMER to call it..

iPhone CATransition adds a fade to the start and end of any animation?

So I am just beginning recently developing some simple apps for the iphone. I will say that I am fairly sure I don't have a strong understanding of programming for multiple views yet, but I am trying to learn as I go.
I have a program that started as a plain window based application so i could hand write everything in hopes of learning more about what i am doing. I have a single view controller that acts to load and release views as requested from each of the other view controllers. No elements persist from one view to the other.
I have that working fine currently, but I wanted to add animations to the view changing. A simple push animation was my goal. One view pushes out as the new view pushes in.
Looking into CATransitions and trying that, I have a working version (currently for pushing top/bottom)
[thisView.view removeFromSuperview];
[thisView release];
thisView = [[MenuViewController alloc] initWithNibName:#"MenuView" bundle:nil];
[self.view addSubview:thisView.view];
CATransition *animation = [CATransition animation];
[animation setDuration:6.3];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromTop];
[animation setRemovedOnCompletion:YES];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]];
[[self.view layer] addAnimation:animation forKey:nil];
as far as I can tell this is pretty standard code for using CATransition and it works to do what I need, one view gets pushed up as the other view comes in. However my problem is that there seems to be a fade that happens to each view as they come in or go out respectively.
As such - in this example; as the menu pushes up from the bottom, it will very slowly fade in from white, and as the previous view leaves the screen it will slowly fade to white.
Note that the duration is set to 6 so that the fading is dramatic.
Is there a way to remove the fading here so that each view remains solid on the way in and the way out? Or have I missed the mark completely in this route that I am taking?
I appreciate any help. Apologies I have been long winded.
I have never been able to find a solution to this problem, but I can offer a reasonable workaround. What's happening is it isn't fading to white, but fading to transparent, and the window background (or whatever view is behind) is white. There are a couple ways to get around this:
Change the window background color. If both views you're fading between have the same solid background color, then this will look pretty good.
Don't render a background in each view ("MenuView," for example), but rather have a shared background view that's under those views at all times.
Note that this will not work in all circumstances -- grouped UITableViews, for example, are always completely opaque.
(As I side note, I assume that you aren't build a navigation-based application, in which case all the animation should be handled automatically.)
You also might want to consider the looking into the UIView method setAnimationTransition:forView:cache: if you haven't already as another way to transition between views (although it cannot do a sliding animation, if you are set on that).
I solved this by enclosing the view to which I have applied the effect into a superview and by setting the superview property "clip subviews". now the fade is "clipped" by the superview.
I was able to get the views to transition without fading at the beginning and end by using UIView animation. NOTE: In the code below, I have a UINavigationController and a UITabBarController inside a main UIView. The main UIVIew (containerView) is what I added as a subView to the Application window. The other two are subviews of the containerView.
UITabBarController *tabBarController = [(AppDelegate_iPhone *)[[UIApplication sharedApplication] delegate] tabBarController];
UIView *containerView = [(AppDelegate_iPhone *)[[UIApplication sharedApplication] delegate] containerView];
UINavigationController *accountsNavigationController = [(AppDelegate_iPhone *)[[UIApplication sharedApplication] delegate] accountsNavigationController];
CGRect accountsNavigationControllerEndFrame = containerView.frame;
CGRect tabBarControllerEndFrame = CGRectMake(containerView.frame.size.width, containerView.frame.origin.y, containerView.frame.size.width, containerView.frame.size.height);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.4];
tabBarController.view.frame = tabBarControllerEndFrame;
accountsNavigationController.view.frame = accountsNavigationControllerEndFrame;
[UIView commitAnimations];