在初始化PhoneGap之前显示ViewController

问题描述:

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

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下?

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

self.viewController.useSplashScreen = YES;

+0

不幸的是,这个问题似乎是由于创建一个'UIWindow'然后PhoneGapDelegate.m被重新创建这个窗口。当它重新创建'UIWindow'时,方向不正确。 – MobileOverlord 2012-02-28 18:24:39