在初始化PhoneGap之前显示ViewController

时间:2012-02-22 18:11:30

标签: ios ipad cordova uiwindow

我们目前正在使用PhoneGap为客户端构建移动应用程序,并且需要在PhoneGap初始化之前提供UIViewController以检查是否有任何Web文件更改。该应用程序完成PhoneGap 1.4.1,我试图通过扩展PhoneGap项目而不是PhoneGap库来实现这一目标。以下是我在application:didFinishLaunchingWithOptions:

中所做的事情
hostReach = [[Reachability reachabilityWithHostName: @"google.com"] retain];
internetReach = [[Reachability reachabilityForInternetConnection] retain];
//wifiReach = [[Reachability reachabilityForLocalWiFi] retain];

if (internetReach && hostReach) {
    self.app = application;
    self.options = launchOptions;
    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(updateFinished:) name: @"applicationUpdatingFinished" object: nil];

    NSLog(@"Windows:%i",[[UIApplication sharedApplication].windows count]);

    //[super application:app didFinishLaunchingWithOptions:options];
    CGRect screenBounds = [ [ UIScreen mainScreen ] bounds ];
    self.window = [ [ [ UIWindow alloc ] initWithFrame:screenBounds ] autorelease ];
    UpdateViewController *updateVC = [[UpdateViewController alloc]init];
    [updateVC.view setFrame:screenBounds];
    [self.window makeKeyAndVisible];
    return YES;
}

/////////////////////
// END Check for updates
/////////////////////

    return [super application:application didFinishLaunchingWithOptions:launchOptions];

这是我在UpdateViewController完成后正在触发的内容。

-(void)updateFinished:(NSNotification*)n {
    [super application:app didFinishLaunchingWithOptions:options];
}

更新视图控制器执行其应有的功能,检查并下载任何新的Web文件。问题是看起来Default.png图像继续显示,当我添加UpdateViewController的视图时,它将它放在Default.png图像下。在PhoneGap的application:didFinishLaunchingWithOptions:被调用之前,此图像不会消失。

有关更好的方法的想法,或者为什么UpdateViewController在Default.png下显示?

1 个答案:

答案 0 :(得分:0)

你的项目中是否有这样的代码?

  

self.viewController.useSplashScreen = YES;