开发者

Good ways to dynamically generate the start image of an iPhone/iPad app

开发者 https://www.devze.com 2022-12-27 12:33 出处:网络
I\'m self-learning iPhone development and I see that one of the aspects of an iPhone/iPad app is the start image that gets displayed when your app is run.I\'d like my start image to display some basic

I'm self-learning iPhone development and I see that one of the aspects of an iPhone/iPad app is the start image that gets displayed when your app is run. I'd like my start image to display some basic info about the user when the app is launched, but that info has to first be collected by the user when the app is first run. That tells me that I either need to dynamically genera开发者_运维问答te the start image after the user enters their information or I need to place a label of some sort on top of my static start image in order to accomplish this. The first time the app launched and before the user enters their info, the start image can be anything or nothing at all, I'm not concerned about this.

So, my questions are...

  1. Can you place controls, like a label, on top of the start image when your app is launched?
  2. If not, what's a good approach to dynamically generating the start image after the app is launched for the first time and the user info is collected?
  3. If there's no way to change this start image (thanks kristopher!), can I instead display my dynamically generated image for a set amount of time (~3 seconds) as soon as the start image closes? Do I even have to use a start image at all?

Thanks so much in advance for your help! I'm going to begin researching this question right now.


To answer number 3, Yes, you need a start image. It should look like your dynamic start image but without the dynamic information.

To display the dynamic information briefly after launch, just use a modal view controller on top of whatever view controller comes up first (called viewController below):

SplashScreenController *splashScreen = [[SplashScreenController alloc] initWithNibName:@"SplashScreenController" bundle:nil];
[viewController presentModalViewController splashScreenController animated:NO];
[splashScreenController release];

[viewController performSelector:@selector(dismissModalViewControllerAnimated:) withObject:YES afterDelay:3];

Obviously you need to create a UIViewController subclass and xib file called SplashScreenController.


Apps can't change their start images. Those image files, as well as other files in the app's bundle, are treated as read-only by the OS.

If you don't have a startup image, then the user will just see a black screen for a second or two (or more, depending on how big your app is). It's a good idea to have a startup image.

You can display whatever you want after your app starts running.


I do something similar to what you are trying to accomplish, except I do not display user information. If you want to see what I did, check out my app How Long Can You Tap It (free). The Very first image, as Kristopher mentioned, is not changeable. It will be displayed for as long as the application takes to load. Then, the image will disappear and show your initial viewController, which will be whatever you want. In my app, it simply is the same image is the initial image, but instead of saying LOADING I display text telling you to Tap the screen to start playing. If you don't want to rely on the user to tap the screen to continue, you can do what Frank said and dismiss it within X number of seconds. If you want more code than what Frank provided, let us know.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号