在初始化 PhoneGap 之前显示 ViewController
我们目前正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的项目中有这样的代码吗?
Do you have code like this in your project?