1

我想显示一个比默认启动屏幕更长的时间的启动屏幕。一种方法是在 App Delegate 的 didFinishLaunchingWitOptions 方法中放置一个图像视图。我正在放置一个图像视图,如下所示,现在我从不把它取下来,因为我想确保它有效。

我从来没有看到图像视图!UIImage 已创建(文件存在)并且打印的大小是正确的..

我究竟做错了什么?为什么不显示?谢谢!

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    // Put an image view splash screen up for a little while for loading purposes
    UIImage *image = [UIImage imageNamed:@"Default-568h@2x.png"];
    NSLog(@"image size is %f %f",image.size.height,image.size.width);
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
    imageView.frame = self.window.bounds;
    //imageView.frame=CGRectMake(0, 0, 320, 480);
    imageView.alpha = 1.0f;
    imageView.hidden = NO;
    [self.window addSubview:imageView];
    [self.window makeKeyAndVisible];

    return YES;

}
4

1 回答 1

3

尝试将您附加UIView到 aUIViewController并将此视图控制器设置为窗口根视图控制器:

UIViewController *vc = [[UIViewController alloc] init];
[vc.view addSubview:imageView]
self.window.rootViewController = vc;
[self.window addSubview:vc.view];
[self.window makeKeyAndVisible];
于 2013-06-30T21:26:01.970 回答