iphone - 显示闪屏时从 Web 服务加载数据

标签 iphone web-services splash-screen

我正在尝试在显示启动屏幕时从网络服务加载一些数据。

我正在尝试使用下面的代码来实现这一点,但我仍然无法找到合适的解决方案。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [self backgroundtask];
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]         autorelease];
    splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
    splashView.image = [UIImage imageNamed:@"Default.png"];
    [self.window addSubview:splashView];
    [self.window bringSubviewToFront:splashView];

    ViewController *masterViewController = [[[ViewController alloc]         initWithNibName:@"ViewController" bundle:nil] autorelease];
    self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];
    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];
}

最佳答案

如果您想显示启动屏幕,只需将名为“default.png”的图像文件放入资源中即可。该应用程序将在启动时在加载任何 View 之前自动显示该内容。并在 didFinishLaunchingWithOptions 中包含代码的其余部分

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
 [self backgroundtask];
 self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]         autorelease];


 ViewController *masterViewController = [[[ViewController alloc]         initWithNibName:@"ViewController" bundle:nil] autorelease];
 self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];
 self.window.rootViewController = self.navigationController;
 [self.window makeKeyAndVisible];
}

关于iphone - 显示闪屏时从 Web 服务加载数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12178091/

相关文章:

windows - Windows 初始屏幕的标准尺寸

iphone - Objective C用字符串动态调用方法

iphone - 将 iPhone 应用程序转换为 iPad 应用程序(只是简单的部分)

iphone - UIButton 复选框

iphone - Unity 应用程序在第一个场景中崩溃

c# - 并行执行网络服务调用

java - 如何在服务器上的特定时间执行某些代码..?

web-services - 是否有网络服务可用于检查某人的信用评分?

excel - VBA 启动画面

android - 黑屏出现在飞溅之前