2014-02-06 55 views
0

我已经创建了一个phonegap ios项目。在目前闪屏后它加载了一个index.html文件。我喜欢在启动画面后添加一个介绍viewcontroller像下面的图像和用户有一个选项关闭介绍viewcontroller,以便他们可以看到index.html文件。如何在phonegap项目中的启动画面后添加UIViewController?

有没有反正在加载index.html之前添加UIViewController文件?

如:启动屏幕 - >引言视图 - 控制 - > index.html的

enter image description here

回答

1

去上课>> AppDelegate.m文件与此代码

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions 
{ 
CGRect screenBounds = [[UIScreen mainScreen] bounds]; 

self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease]; 
self.window.autoresizesSubviews = YES; 

self.viewController = [[[MainViewController alloc] init] autorelease]; 
self.viewController.useSplashScreen = YES;  
UIViewController *myController = [[UIViewController alloc] init];  
UIView *myView = [[UIView alloc] initWithFrame:self.viewController.view.frame]; 
myView.backgroundColor = [UIColor whiteColor]; 
myController.view = myView;  
UINavigationController *myNav = [[UINavigationController alloc] initWithRootViewController:myController]; 

UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" 
                   style:UIBarButtonItemStyleDone target:self action:@selector(cancel)]; 
myController.navigationItem.leftBarButtonItem = leftButton; 
self.window.rootViewController = myNav; 
[self.window makeKeyAndVisible]; 

return YES; 
} 

-(void)cancel{ 
    self.window.rootViewController = self.viewController; 
    [self.window makeKeyAndVisible];  
} 
+0

更换didFinishLaunchingWithOptions功能你请告诉我如果我加了这个会发生什么? – Bangalore

+0

根据SPLASH SCREEN - > INTRODUCTION VIEWCONTROLLER - > INDEX.html在启动画面加载这个自定义viewcontroller后有左边的取消按钮,你用加载index.html文件 – Ved

+0

它的工作很棒后用这个按钮做动作.. – Bangalore