Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-08-2010, 03:11 PM   #1 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 3
juna1418 is on a distinguished road
Question Splash Screen Series

Hi, I'm quite new to the IPhone Development, so I'd be extremely grateful for any kind of advice My game app uses a tabbar and so far has a single splash screen. Now I'd like to add at least two other images/text as intro, but so far couldn't come up with any idea that makes sense...
Is it possible to make use of an array and if how could the code look like? Or is there another way?
juna1418 is offline   Reply With Quote
Old 09-08-2010, 04:55 PM   #2 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 577
Speed is on a distinguished road
Default

What I usually do is overlay 2 images in my application in interface builder. I then run 2 timers. One is to fade out the first image, the other is to fade out the second image. Additionally, you can make the 2 images act as buttons so users cannot run your interface through the image and upon tapping the image, the corresponding image is faded juts like if the timer had faded it.
Speed is offline   Reply With Quote
Old 09-08-2010, 05:37 PM   #3 (permalink)
Fly-by-night Innovator
 
Join Date: Jun 2010
Posts: 364
musicwind95 is on a distinguished road
Default

I'd like to do the same, but do so in the launch time...

For example, say I know that my app takes about 5 seconds to load. I'd like to display a splash for 3 seconds, then a launch image for the remainder...how would I do that (if at all)? Obviously, I don't want to prolong the loading time simply for a splash screen—it detracts from the user experience.
__________________
If I have helped you, please consider donating. I use PayPal. It would mean a lot to me!


For more iOS Development, check out my blog—Cups of Cocoa. All visitors welcome, but especially beginners!

Hope I have helped!

Please check out IceFall, a new action game available in the App Store!
musicwind95 is offline   Reply With Quote
Old 09-08-2010, 09:52 PM   #4 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 577
Speed is on a distinguished road
Default

Code:
-(void)viewDidLoad {
	
	UIImage *mySplashImage = [UIImage imageNamed:@"myImage.png"];
	myImageView = [[UIImageView alloc] initWithImage:mySplashImage];
	myImageView.frame = CGRectMake(0, 0, 320, 480);
	[self.view addSubview:myImageView];
	
	NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(hideSplashScreen) userInfo:nil repeats:NO];
	timer = nil;
	
}

-(void)hideSplashScreen {
	
	myImageView.alpha = 0.0;
	
	NSLog(@"hidden");
	
}
This creates an image right after the launch screen, waits 2 seconds, then goes and hides it again.

To hide 2 images, try this:

Code:
-(void)viewDidLoad {
	
	UIImage *mySplashImage = [UIImage imageNamed:@"image.png"];
	myImageView = [[UIImageView alloc] initWithImage:mySplashImage];
	myImageView.frame = CGRectMake(0, 0, 320, 480);
	
	UIImage *mySplashImage1 = [UIImage imageNamed:@"anotherImage.png"];
	myImageView1 = [[UIImageView alloc] initWithImage:mySplashImage1];
	myImageView1.frame = CGRectMake(0, 0, 320, 480);
	[self.view addSubview:myImageView1];
[self.view addSubview:myImageView];
	
	NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(hideSplashScreen) userInfo:nil repeats:NO];
	timer = nil;
	
	NSTimer *timer1 = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(hideSecondSplash) userInfo:nil repeats:NO];
	timer1 = nil;
	
}

-(void)hideSplashScreen {
	
	myImageView.alpha = 0.0;
	
	NSLog(@"hidden");
	
}

-(void)hideSecondSplash {
	
	myImageView1.alpha = 0.0;
	
}

Last edited by Speed; 09-09-2010 at 11:48 AM.
Speed is offline   Reply With Quote
Old 09-09-2010, 04:38 AM   #5 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 3
juna1418 is on a distinguished road
Default

Thanks a lot I tried it, but there still seems to be a small problem, since beside the first image nothing will show up . There seems to be some conflict with my main TabBarView: the screen turns black and my Main-TabBarView won't show. I wonder what kind of mistake I made..
juna1418 is offline   Reply With Quote
Old 09-09-2010, 11:50 AM   #6 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 577
Speed is on a distinguished road
Default

Oops, I was making the second image disappear later even though it was the image on top. Try the new code. It makes the images both appear on the load, then the one disappears after 2 seconds and the other goes after 3 additional seconds. I have tested it and it is working fine.
Speed is offline   Reply With Quote
Old 09-09-2010, 12:58 PM   #7 (permalink)
Registered Member
 
Join Date: Jul 2010
Location: Texas
Posts: 40
ronbowalker is on a distinguished road
Default

I am trying to follow you on this info, but I am not able to get this to work. Using just a single image, does this code go in the AppDelegate.m file? And "myImageView" would be what? a xib with a UIImage in it?

Please help me to understand how you are doing this....I am trying hard to learn as best I can.

Thanks
ronbowalker is offline   Reply With Quote
Old 09-09-2010, 04:43 PM   #8 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 577
Speed is on a distinguished road
Default

You will put this in your viewController (RootViewController) or the one that you first see when you open your application.

Now, add 2 imageView declarations in your .h file. This allows us to make the imageViews disappear. (UIImageView *imageView

Now, you can input the code, and import your images into the Resources folder in your application. You can then select the image that you want to display by adjusting the code that says YourImageHere.png.

It will work after that.
Speed is offline   Reply With Quote
Old 09-10-2010, 02:44 PM   #9 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 3
juna1418 is on a distinguished road
Default

Hmm, unfortunately it didn't work that way for me. I tried several alterations, but if at all, there was just the usual appearance of my good old TabBar...
other than that the console gave just some remarks about not fitting Objective-C and others
in a somewhat different form, wouldn't it fit in here?:

- (BOOL)applicationUIApplication *)application didFinishLaunchingWithOptionsNSDictionary *)launchOptions {

[window addSubview:rootTabBarController.view];
[window makeKeyAndVisible];

....
juna1418 is offline   Reply With Quote
Old 09-10-2010, 05:40 PM   #10 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 577
Speed is on a distinguished road
Default

Quote:
Originally Posted by juna1418 View Post
Hmm, unfortunately it didn't work that way for me. I tried several alterations, but if at all, there was just the usual appearance of my good old TabBar...
other than that the console gave just some remarks about not fitting Objective-C and others
in a somewhat different form, wouldn't it fit in here?:

- (BOOL)applicationUIApplication *)application didFinishLaunchingWithOptionsNSDictionary *)launchOptions {

[window addSubview:rootTabBarController.view];
[window makeKeyAndVisible];

....
I do not usually put stuff into the AppDelegate. You want to put it into the ViewController.
Speed is offline   Reply With Quote
Reply

Bookmarks

Tags
splash screen

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 333
11 members and 322 guests
bignoggins, carlandrews, flamingliquid, hzwegjxg, ilmman, jenniead38, linkmx, nadav@webtview.com, stanny, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:50 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0