【发布时间】:2011-04-01 14:12:22
【问题描述】:
我是 iPhone 开发者的初学者,我正在开发我的第一个应用程序。实际上,我已经很好地创建了一个 Tab Bar 应用程序,但我想在运行应用程序时添加启动画面。
我在Loading a Welcome Screen(Splash Screen) before TabBarController找到了一个确切的问题
但是当我尝试输入我的代码时,启动画面没有加载,只是继续显示我的 tabbarcontroller。
我创建了一个 SplashViewController.h、SplashViewController.m 和 SplashView.xib,下面是我的代码,
#import "SplashViewController.h"
...
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
SplashViewController *controller = [[SplashViewController alloc] initWithNibName:@"SplashView" bundle:nil];
[self.tabBarController presentModalViewController:controller animated:YES];
[controller release];
// Add the tab bar controller's view to the window and display.
[self.window addSubview:tabBarController.view];
[self.window makeKeyAndVisible];
return YES;
}
应用程序运行没有错误,但无法加载启动画面,任何评论都非常感谢。谢谢!
【问题讨论】:
-
您的 SplashScreenController 是做什么的?您是否定义了 .xib 中可见的任何内容?如果你想要一张静态图片,你可以把 id Default.png 命名为你的包,不需要其他代码。
-
对,在启动应用程序时将我的图像文件重命名为 Default.png 后可以看到它,但我想按住它,直到用户按下任何关闭位置。有什么建议吗?谢谢!
标签: ios objective-c iphone ipad uitabbarcontroller