在初始化 PhoneGap 之前显示 ViewController

发布于 2025-01-07 18:01:25 字数 1790 浏览 2 评论 0原文

我们目前正在使用 PhoneGap 为客户端构建移动应用程序,并且需要提供一个 UIViewController 来在 PhoneGap 初始化之前检查任何 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 下?

We are currently building a mobile app for a client using PhoneGap and need to present a UIViewController to check for any web file changes before PhoneGap initializes. The app is done with PhoneGap 1.4.1 and I am trying to accomplish this by extending the PhoneGap project but not the PhoneGap library. Here is what I am doing in 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];

And here is what I am firing after the UpdateViewController finishes.

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

The update view controller does what its supposed to, checks and downloads any new web files. The problem is that it appears the Default.png image continues to display and when I add UpdateViewController's view, it places it under the Default.png image. this image does not go away until PhoneGap's application:didFinishLaunchingWithOptions: gets called.

Any ideas on a better way, or why the UpdateViewController is displaying under the Default.png?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半世蒼涼 2025-01-14 18:01:25

你的项目中有这样的代码吗?

self.viewController.useSplashScreen = YES;

Do you have code like this in your project?

self.viewController.useSplashScreen = YES;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文