2016-08-24 90 views
0

我做了我的第一個iOS應用程序,但我遇到了鍵盤問題。 您無法隱藏鍵盤。附件欄(關閉/上一個/下一個箭頭)不可見。Ionic 2 InAppBrowser默認隱藏配件欄

而另一個問題是它不會在登錄後自動關閉。所以用戶最終在他的屏幕上放了一個鍵盤。只有在網站內導航時纔會關閉。

儘管代碼很簡單,但應用程序打開了InAppBrowser並加載了一個需要登錄的站點。

Login

After login

代碼示例:

import {Component, ViewChild} from '@angular/core'; 
import {ionicBootstrap, Platform, MenuController, Nav} from 'ionic-angular'; 
import {StatusBar} from 'ionic-native'; 
import {HelloIonicPage} from './pages/hello-ionic/hello-ionic'; 
import {ListPage} from './pages/list/list'; 
import {InfoPage} from './pages/info/info'; 
import {InAppBrowser} from 'ionic-native'; 
import {Splashscreen} from 'ionic-native'; 
import {Keyboard} from 'ionic-native'; 

@Component({ 
    templateUrl: 'build/app.html' 
}) 
class MyApp { 
    @ViewChild(Nav) nav: Nav; 

    // make HelloIonicPage the root (or first) page 
    rootPage: any = HelloIonicPage; 
    pages: Array<{title: string, component: any}>; 
    inAppBrowserRef; 

    constructor(
    private platform: Platform, 
    private menu: MenuController 
) { 
    document.addEventListener('resume',() => { 
     console.log("App has been resumed, reopen InAppBrowser url"); 
     this.openInAppBrowser(); 
    }); 
    this.initializeApp(); 

    // set our app's pages 
    this.pages = [ 
     { title: 'Launch', component: HelloIonicPage }, 
     { title: 'Info', component: InfoPage }, 
    ]; 
    } 

    initializeApp() { 
    this.platform.ready().then(() => { 
     // Okay, so the platform is ready and our plugins are available. 
     // Here you can do any higher level native things you might need. 
     StatusBar.styleDefault(); 
     //Show previous/next/done button on keyboard 
     this.openInAppBrowser(); 
    }); 
    } 

    openInAppBrowser() { 
    //Directly load website 
    this.inAppBrowserRef = InAppBrowser.open("http://ws001.domeassistance.be:50001/", "_blank", "location=no,fullscreen=yes,toolbar=no,clearcache=yes,clearsessioncache=yes"); 
    } 
} 

ionicBootstrap(MyApp); 

任何幫助嗎?

//另一個謎題:在iOS上使用Phonegap進行調試時,我會獲得配件欄,但是當我將它構建爲真正的應用程序時,不會發生這種情況嗎?

// EDIT2:如果我設置位置= YES時Accessorybar出現,但後來我看到這是不是我想要關閉過程中,頁面底部一個討厭的網址...

+0

你甚至可以嘗試在https://itunes.apple.com/us/app/dome-assistance-app/id1135786020?mt=8 – saibot

回答

0

我用_system代替_blank。然後我有了自動填充和完成按鈕的鍵盤頂部欄。

openInAppBrowser() { 
    this.inAppBrowserRef=InAppBrowser.open("http://ws001.domeassistance.be:50001/", "_system", "location=no,fullscreen=yes,toolbar=no,clearcache=yes,clearsessioncache=yes"); 
} 
+0

我給它一個嘗試,提前 – saibot

+0

感謝不幸的是使用_system打開Safari瀏覽器。我需要使用_blank,以便用戶不會注意到他實際上正在打開一個網站。 – saibot