2014-02-06 2 views
0

Я создал один проект ios phonegap. В настоящее время после заставки загружается файл index.html. Мне нравится добавить один просмотр viewcontroller, как показано ниже, после заставки, и у пользователя есть возможность закрыть представление viewcontroller, чтобы он мог видеть файл index.html.Как я могу добавить UIViewController после заставки в проекте phonegap?

Можно ли добавить файл UIViewController перед загрузкой index.html ??

например: ЗАСТАВКА -> ВВЕДЕНИЕ ViewController -> index.html

enter image description here

ответ

1

Перейти к классам >> AppDelegate.m файл заменить функцию didFinishLaunchingWithOptions с этим кодом

- (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

может скажите, пожалуйста, что произойдет, если я добавлю это? – Bangalore

+0

В соответствии с SPLASH SCREEN -> INTRODUCTION VIEWCONTROLLER -> INDEX.html после заставки экрана загрузите этот настраиваемый контроллер просмотра на кнопку отмены слева, вы выполните действие с помощью этой кнопки после загрузки index.html файла – Ved

+0

его отлично работает .. – Bangalore

Смежные вопросы