2016-07-27 109 views
0

在我的應用程序委託中,我已將全局默認色調設置爲白色,因爲我的應用程序內部的所有導航欄均爲黑色。當ADALiOS去驗證一個用戶時,我會看到下面這張圖片。如果仔細觀察,可以在左上角以白色字母看到取消按鈕。更改UI文字色彩ADAL iOS內部色彩驗證

是否有任何解決方法將文本顏色或導航欄顏色更改爲黑色?

裏面viewDidLoad()我調用下面的方法:

authManager.login() { 
      (authenticated: Bool, token: String) -> Void in 
      if (authenticated) { 
       self.setupMapView() 
       self.getJSON() 
      } else { 
       print("Authentication Failed!") 
       self.loginToolbar.alpha = 1.0 
       self.listButton.enabled = false 
       self.filterButton.enabled = false 
       self.refreshButton.enabled = false 
      } 
     } 

這裏是我的AuthManager類內部的login()功能:

func login(completionBlock:((Bool, String) -> Void)) { 
      var er:ADAuthenticationError? = nil 
    let authContext = ADAuthenticationContext(authority: authority, error: &er) 
    var token: String! 
    authContext.acquireTokenWithResource(resourceURI, clientId: clientID, redirectUri: redirectURI, userId: NSUserDefaults.standardUserDefaults().stringForKey("username")) { 
     (result: ADAuthenticationResult!) -> Void in 
     if result.status.rawValue != AD_SUCCEEDED.rawValue { 
      completionBlock(false, result.error.description) 
     } else { 
      token = result.accessToken 
      let username = result.tokenCacheStoreItem.userInformation.userId 
      self.storeUsername(username) 
      completionBlock(true, token) 
     } 
    } 
} 

Color of Cancel button in top left corner is white.

回答

0

如果你看一下在AuthenticationContext性質ADAL給你,有一些ViewController屬性如:parent,child,e tc。

ADAuthenticationContext還允許您訪問.webView屬性。也許通過這條路線定製是可能的。

的WebView:

_authContext.webView.inputViewController?.navigationController?.navigationBar.barTintColor = .black 

ParentView

_authContext.parentController.navigationController?.navigationBar.tintColor = .black 

我試過訪問父母的NavBar,但我還沒有看到任何成功。

我這週一直在處理這個問題,以及似乎無法找到直接的解決方案,但是我想分享我的發現,希望它可以幫助你解決這個問題。也許其中一些可能導致我們訪問控制器的NavBar,但我認爲最終需要更改像tint/title/color之類的欄設置。

如果我得到它的工作將發佈進一步的答覆。如果你已經解決了你自己,請更新。

更新:我已經在我的AppDelegate簡單地增加我的結束解決了這個。

UINavigationBar.appearance().barStyle = .blackOpaque 
UINavigationBar.appearance().tintColor = .white 

你或許可以切換此進出你的viewController的出現/如果你需要它只是個人頁面中消失的方法的。

+0

我已經使用其他解決方案更新了我的回覆。 – pCanniff