2014-02-06 50 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